Spaces:
showme
/
Running

showme commited on
Commit
142d567
·
verified ·
1 Parent(s): ffb4958

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # 加载模型
5
+ sentiment_model = pipeline("Hello-SimpleAI/chatgpt-detector-roberta") 
6
+
7
+ def predict(text):
8
+ return sentiment_model(text)
9
+
10
+ # 构建 UI
11
+ interface = gr.Interface(
12
+ fn=predict,
13
+ inputs="text",
14
+ outputs="text",
15
+ title="Hello-SimpleAI/chatgpt-detector-roberta" 
16
+ )
17
+
18
+ interface.launch()