Spaces:
Runtime error
Runtime error
File size: 650 Bytes
2168cf5 ef26fd6 2168cf5 ef26fd6 2168cf5 ef26fd6 2168cf5 ef26fd6 2168cf5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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
)
examples = [
"Ada apa dengan Jokowi di istana negara?",
]
def sentiment_analysis(text):
scores = sid.polarity_scores(text)
del scores["compound"]
return scores
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() |