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