seawolf2357 commited on
Commit
ec5aa0b
·
verified ·
1 Parent(s): 838e56a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # 감정 분석 파이프라인을 생성합니다.
5
+ sentiment_pipeline = pipeline("sentiment-analysis")
6
+
7
+ def analyze_sentiment(text):
8
+ # 입력된 텍스트에 대한 감정 분석을 수행합니다.
9
+ result = sentiment_pipeline(text)
10
+ # 분석 결과를 반환합니다.
11
+ return result[0]
12
+
13
+ # Gradio 인터페이스를 생성합니다.
14
+ interface = gr.Interface(fn=analyze_sentiment,
15
+ inputs=gr.Textbox(lines=2, placeholder="Enter Text Here..."),
16
+ outputs="json",
17
+ title="Text Sentiment Analysis",
18
+ description="Enter a piece of text to analyze its sentiment. The model will classify it as positive or negative.")
19
+
20
+ # 앱을 실행합니다.
21
+ if __name__ == "__main__":
22
+ interface.launch()