File size: 374 Bytes
142d567 08c2de9 142d567 30f347f 142d567 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from transformers import pipeline
# 加载模型
sentiment_model = pipeline("text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta")
def predict(text):
return sentiment_model(text)
# 构建 UI
interface = gr.Interface(
fn=predict,
inputs="text",
outputs="text",
title="chatgpt-detector-roberta"
)
interface.launch()
|