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() | |