suinY00N commited on
Commit
4e9d310
โ€ข
1 Parent(s): 8d37a8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -7,22 +7,11 @@ sentiment = pipeline("sentiment-analysis")
7
  # ์‚ฌ์šฉ์ž ์ž…๋ ฅ์— ๋Œ€ํ•œ ๊ฐ์„ฑ ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
8
  def get_sentiment(์ž…๋ ฅ):
9
  # ๊ฐ์„ฑ ๋ถ„์„ ์‹คํ–‰
10
- result = sentiment(์ž…๋ ฅ)
11
- # ๊ฒฐ๊ณผ ํฌ๋งทํŒ… ๋ฐ ๋ฐ˜ํ™˜
12
- return result[0]
13
 
14
- # Gradio ์•ฑ ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
15
- iface = gr.Interface(
16
- fn=get_sentiment, # ์‹คํ–‰ํ•  ํ•จ์ˆ˜
17
- inputs=gr.inputs.Textbox(lines=2, placeholder="์—ฌ๊ธฐ์— ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”..."), # ์ž…๋ ฅ๋ž€ ์„ค์ •
18
- outputs="json", # ์ถœ๋ ฅ ํ˜•ํƒœ
19
- clear_on_submit=True, # ์ œ์ถœ ํ›„ ์ž…๋ ฅ๋ž€ ํด๋ฆฌ์–ด
20
- title="ํ…์ŠคํŠธ ๊ฐ์„ฑ ๋ถ„์„", # UI ์ œ๋ชฉ
21
- description="ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์ œ์ถœ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ๊ฐ์„ฑ ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•˜์„ธ์š”." # UI ์„ค๋ช…
22
- )
23
 
24
- # Gradio ์•ฑ ์‹คํ–‰
25
- iface.launch()
26
 
27
  # import gradio as gr
28
  # from transformers import pipeline
 
7
  # ์‚ฌ์šฉ์ž ์ž…๋ ฅ์— ๋Œ€ํ•œ ๊ฐ์„ฑ ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
8
  def get_sentiment(์ž…๋ ฅ):
9
  # ๊ฐ์„ฑ ๋ถ„์„ ์‹คํ–‰
10
+ return sentiment(์ž…๋ ฅ)
 
 
11
 
 
 
 
 
 
 
 
 
 
12
 
13
+ gr.Interface(fn=ask_question, inputs="์ž…๋ ฅ", outputs="output", title="Sentiment Analysis", description="").launch()
14
+
15
 
16
  # import gradio as gr
17
  # from transformers import pipeline