File size: 1,080 Bytes
58c7cdc
 
 
282faa1
58c7cdc
 
282faa1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import pipeline
import gradio as gr

# Load sentiment analysis pipeline with model
pipe = pipeline("text-classification", model="arifagustyawan/sentiment-roberta-id")

# Define the header, subheader, and example texts
header = "Sentiment Analysis"
subheader = "Evaluate the sentiment of Indonesian text using the RoBERTa model and IndoNLU dataset"

example_texts = [
    "Film ini sangat menyenangkan. Aktingnya luar biasa, dan alur ceritanya membuat saya terlibat sepanjang film.",
    "Cuaca hari ini sangat buruk. Hujan terus-menerus membuat suasana hati saya merasa lesu.",
    "Saya merasa campur aduk setelah menonton pertandingan tadi malam. Tim favorit saya kalah tetapi memberikan pertunjukan yang luar biasa."
]

# Create Gradio interface with header, subheader, and example texts
demo = gr.Interface.from_pipeline(pipe, 
                                  title=header, 
                                  description=subheader,
                                  examples=[[text] for text in example_texts])

# Launch the Gradio interface
demo.launch()