File size: 387 Bytes
142d567 ca579d7 142d567 0aa7228 142d567 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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()
|