sent_suin / app.py
suinY00N's picture
Update app.py
e57ecae verified
raw
history blame
No virus
1.01 kB
import gradio as gr
from transformers import pipeline
# Assuming you want to use a specific model for sentiment analysis; if not, the pipeline defaults to an English model.
# For multilingual support including Korean, you might need to specify a model that supports Korean.
# For this example, we'll proceed with the default model for demonstration purposes.
sentiment_analysis = pipeline("sentiment-analysis")
def get_sentiment(text):
# Perform sentiment analysis on the input text
return sentiment_analysis(text)
# Define the Gradio interface
interface = gr.Interface(
fn=get_sentiment, # function to call
inputs=gr.inputs.Textbox(lines=2, placeholder="์—ฌ๊ธฐ์— ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”..."), # input component
outputs="text", # output component
title="Sentiment Analysis", # title of the interface
description="This app analyzes the sentiment of input text. Enter text to see if it's positive or negative." # description
)
# Launch the Gradio app
interface.launch()