File size: 1,011 Bytes
5239a8a
 
 
 
 
 
 
 
 
 
e57ecae
5239a8a
 
 
 
 
 
e57ecae
5239a8a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()