suinY00N's picture
Update app.py
5dae49c verified
raw
history blame contribute delete
934 Bytes
import gradio as gr
from transformers import pipeline
# Sentiment analysis pipeline ์ƒ์„ฑ
sentiment = pipeline("sentiment-analysis")
def get_sentiment(์ž…๋ ฅ):
return sentiment(์ž…๋ ฅ)
# Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
interface = gr.Interface(
fn=get_sentiment, # ํ˜ธ์ถœ๋  ํ•จ์ˆ˜
inputs="text", # ์ž…๋ ฅ๋ž€ ์„ค์ •
outputs="text", # ์ถœ๋ ฅ ํ˜•์‹
title="Sentiment Analysis", # UI ์ œ๋ชฉ
description="์ด ์•ฑ์€ ์ž…๋ ฅ๋œ ํ…์ŠคํŠธ์˜ ๊ฐ์„ฑ์„ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค. ๊ธ์ •์ ์ด๊ฑฐ๋‚˜ ๋ถ€์ •์ ์ธ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.", # UI ์„ค๋ช…
examples=[["์ด ์ œํ’ˆ์€ ์ •๋ง ์ข‹์Šต๋‹ˆ๋‹ค!"], ["์ œ ๊ธฐ๋Œ€์— ๋ชป ๋ฏธ์ณค์–ด์š”."]], # ์˜ˆ์‹œ ์ž…๋ ฅ
theme="default", # UI ํ…Œ๋งˆ
layout="vertical" # UI ๋ ˆ์ด์•„์›ƒ
)
# Gradio ์•ฑ ์‹คํ–‰
interface.launch()
# gr.Interface(fn=ask_question, inputs="text", outputs="text", title="KoAlpaca-355M", description="ํ•œ๊ตญ์–ด๋กœ ์งˆ๋ฌธํ•˜์„ธ์š”.").launch()