indobert-hoax / app.py
itshiroto's picture
Update app.py
370acfa verified
raw
history blame
496 Bytes
import gradio as gr
from transformers import pipeline, BertTokenizer
tokenizer = BertTokenizer.from_pretrained("indobenchmark/indobert-base-p1")
classifier = pipeline(model="umn-cyber/indobert-hoax", tokenizer=tokenizer)
def predict(prompt):
completion = classifier(prompt)[0]
return completion['label'], completion['score']
demo = gr.Interface(
fn=predict,
inputs=gr.Textbox(label="News Input"),
outputs=[gr.Text(label="Label"), gr.Number(label="Score")]
)
demo.launch()