Spaces:
Runtime error
Runtime error
| 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() |