Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
# ํ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น
|
3 |
+
!pip install transformers
|
4 |
+
!pip install torch
|
5 |
+
|
6 |
+
# ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ํฌํธ
|
7 |
+
from transformers import pipeline
|
8 |
+
|
9 |
+
# ๊ฐ์ ๋ถ์ ํ์ดํ๋ผ์ธ ์์ฑ
|
10 |
+
classifier = pipeline("sentiment-analysis")
|
11 |
+
|
12 |
+
# ์ฌ์ฉ์๋ก๋ถํฐ ํ
์คํธ ์
๋ ฅ ๋ฐ๊ธฐ
|
13 |
+
text = input("๊ฐ์ ๋ถ์์ ์ํํ ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์: ")
|
14 |
+
|
15 |
+
# ๊ฐ์ ๋ถ์ ์ํ
|
16 |
+
result = classifier(text)
|
17 |
+
|
18 |
+
# ๊ฒฐ๊ณผ ์ถ๋ ฅ
|
19 |
+
print("์
๋ ฅํ ํ
์คํธ์ ๊ฐ์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:")
|
20 |
+
for r in result:
|
21 |
+
print(f"{r['label']}: {r['score']}")
|