yewzy commited on
Commit
3112b9d
·
verified ·
1 Parent(s): 7f1104e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -1,12 +1,14 @@
1
- from fastapi import FastAPI
2
  from transformers import pipeline
3
 
4
- app = FastAPI()
5
-
6
- # Load your Hugging Face model
7
  pipe = pipeline("text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta-chinese")
8
 
9
- @app.post("/detect")
10
- async def detect(text: str):
11
  results = pipe(text)
12
- return {"results": results}
 
 
 
 
 
 
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()