File size: 934 Bytes
f4807cc
0200696
f4807cc
0200696
 
 
 
5dae49c
0200696
 
 
 
5dae49c
0200696
4ea9451
0200696
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()