arifagustyawan's picture
add header, subheader and examples
282faa1
raw
history blame
1.08 kB
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()