oceankim commited on
Commit
748571c
β€’
1 Parent(s): 4f825d3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # 'sentiment-analysis' νŒŒμ΄ν”„λΌμΈ μ΄ˆκΈ°ν™”
5
+ sentiment = pipeline('sentiment-analysis')
6
+
7
+ # 감성 뢄석을 μˆ˜ν–‰ν•˜λŠ” ν•¨μˆ˜ μ •μ˜
8
+ def get_sentiment(text):
9
+ result = sentiment(text)
10
+ return result[0]
11
+
12
+ # Gradio μΈν„°νŽ˜μ΄μŠ€ μ •μ˜
13
+ interface = gr.Interface(fn=get_sentiment,
14
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Type your text here..."),
15
+ outputs='json',
16
+ title="Sentiment Analysis",
17
+ description="Enter text to analyze sentiment.")
18
+
19
+ # Gradio μ•± μ‹€ν–‰
20
+ if __name__ == "__main__":
21
+ interface.launch()