File size: 394 Bytes
9b1388d
5273fda
9b1388d
5273fda
9b1388d
5273fda
 
 
 
8ec8428
 
9b1388d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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"]
    score = score * 100
    return f"The text is {label}, with {score:.1f}% possibility." 
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()