Spaces:
Running
Running
import gradio as gr | |
from transformers import pipeline, BertTokenizer | |
tokenizer = BertTokenizer.from_pretrained("indobenchmark/indobert-base-p1") | |
classifier = pipeline(model="itshiroto/indobert-hoax-detection", 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() |