openai-detector / app.py
WUJUNCHAO's picture
Update app.py
5273fda
raw
history blame
370 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-classification", model="roberta-base-openai-detector")
def greet(text):
data = pipe(text)[0]
label = data["label"]
score = data["score"]
return f"The text is {label}, with {score} confidence score@"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()