Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
-
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
# Load your Hugging Face model
|
7 |
pipe = pipeline("text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta-chinese")
|
8 |
|
9 |
-
|
10 |
-
async def detect(text: str):
|
11 |
results = pipe(text)
|
12 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the model
|
|
|
|
|
5 |
pipe = pipeline("text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta-chinese")
|
6 |
|
7 |
+
def classify_text(text):
|
|
|
8 |
results = pipe(text)
|
9 |
+
return results
|
10 |
+
|
11 |
+
# Create Gradio interface
|
12 |
+
iface = gr.Interface(fn=classify_text, inputs="text", outputs="json", title="Text Classification", description="Classify text using the Hello-SimpleAI/chatgpt-detector-roberta-chinese model")
|
13 |
+
|
14 |
+
iface.launch()
|