wiraindrak's picture
Update app.py
a60235f
raw
history blame
642 Bytes
from transformers import pipeline
import gradio as gr
pretrained_name = "w11wo/indonesian-roberta-base-sentiment-classifier"
sentiment = pipeline(
"sentiment-analysis",
model=pretrained_name,
tokenizer=pretrained_name,
return_all_scores=True
)
examples = [
"Ada apa dengan Jokowi di istana negara?",
]
def sentiment_analysis(text):
output = sentiment(text)
return output[0]
demo = gr.Interface(
fn=sentiment_analysis,
inputs=gr.Textbox(placeholder="Enter a sentence here..."),
outputs="label",
interpretation="default",
examples=[examples])
if __name__ == "__main__":
demo.launch()