240422_n_11 / app.py
oceankim's picture
Create app.py
748571c verified
raw
history blame
No virus
681 Bytes
import gradio as gr
from transformers import pipeline
# 'sentiment-analysis' νŒŒμ΄ν”„λΌμΈ μ΄ˆκΈ°ν™”
sentiment = pipeline('sentiment-analysis')
# 감성 뢄석을 μˆ˜ν–‰ν•˜λŠ” ν•¨μˆ˜ μ •μ˜
def get_sentiment(text):
result = sentiment(text)
return result[0]
# Gradio μΈν„°νŽ˜μ΄μŠ€ μ •μ˜
interface = gr.Interface(fn=get_sentiment,
inputs=gr.inputs.Textbox(lines=2, placeholder="Type your text here..."),
outputs='json',
title="Sentiment Analysis",
description="Enter text to analyze sentiment.")
# Gradio μ•± μ‹€ν–‰
if __name__ == "__main__":
interface.launch()