File size: 383 Bytes
13a9f49
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from transformers import pipeline
import gradio as gr

clf = pipeline("text-classification", model="vnarasiman/unwrap-base")

def predict(text):
    result = clf(text)[0]
    return {"label": result["label"], "confidence": round(result["score"], 3)}

gr.Interface(
    fn=predict,
    inputs=gr.Textbox(placeholder="Paste a Reddit comment here..."),
    outputs=gr.JSON(),
).launch()