| import gradio as gr | |
| from transformers import pipeline | |
| classifier = pipeline( | |
| "text-classification", | |
| model="Hello-SimpleAI/chatgpt-detector-roberta-chinese" | |
| ) | |
| def detect_ai(text): | |
| result = classifier(text) | |
| return result[0] | |
| demo = gr.Interface( | |
| fn=detect_ai, | |
| inputs=gr.Textbox(lines=5, placeholder="Enter text here..."), | |
| outputs="text", | |
| title="ChatGPT Text Detector" | |
| ) | |
| demo.launch() |