indobert-hoax / .ipynb_checkpoints /app-checkpoint.py
Rivo Juicer Wowor
init
e9397d6
raw
history blame contribute delete
506 Bytes
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()