Spaces:
Sleeping
Sleeping
arifagustyawan
commited on
Commit
•
282faa1
1
Parent(s):
e35a5f1
add header, subheader and examples
Browse files
app.py
CHANGED
@@ -1,7 +1,24 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
|
|
4 |
pipe = pipeline("text-classification", model="arifagustyawan/sentiment-roberta-id")
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Load sentiment analysis pipeline with model
|
5 |
pipe = pipeline("text-classification", model="arifagustyawan/sentiment-roberta-id")
|
6 |
|
7 |
+
# Define the header, subheader, and example texts
|
8 |
+
header = "Sentiment Analysis"
|
9 |
+
subheader = "Evaluate the sentiment of Indonesian text using the RoBERTa model and IndoNLU dataset"
|
10 |
+
|
11 |
+
example_texts = [
|
12 |
+
"Film ini sangat menyenangkan. Aktingnya luar biasa, dan alur ceritanya membuat saya terlibat sepanjang film.",
|
13 |
+
"Cuaca hari ini sangat buruk. Hujan terus-menerus membuat suasana hati saya merasa lesu.",
|
14 |
+
"Saya merasa campur aduk setelah menonton pertandingan tadi malam. Tim favorit saya kalah tetapi memberikan pertunjukan yang luar biasa."
|
15 |
+
]
|
16 |
+
|
17 |
+
# Create Gradio interface with header, subheader, and example texts
|
18 |
+
demo = gr.Interface.from_pipeline(pipe,
|
19 |
+
title=header,
|
20 |
+
description=subheader,
|
21 |
+
examples=[[text] for text in example_texts])
|
22 |
+
|
23 |
+
# Launch the Gradio interface
|
24 |
+
demo.launch()
|