copilot-gpt2 / app.py
ndg04041's picture
Update app.py
acb2939 verified
raw
history blame
491 Bytes
pip install -r requirements.txt
# ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž„ํฌํŠธ
from transformers import pipeline
# ๊ฐ์ • ๋ถ„์„ ํŒŒ์ดํ”„๋ผ์ธ ์ƒ์„ฑ
classifier = pipeline("sentiment-analysis")
# ์‚ฌ์šฉ์ž๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ ์ž…๋ ฅ ๋ฐ›๊ธฐ
text = input("๊ฐ์ • ๋ถ„์„์„ ์ˆ˜ํ–‰ํ•  ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”: ")
# ๊ฐ์ • ๋ถ„์„ ์ˆ˜ํ–‰
result = classifier(text)
# ๊ฒฐ๊ณผ ์ถœ๋ ฅ
print("์ž…๋ ฅํ•œ ํ…์ŠคํŠธ์˜ ๊ฐ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:")
for r in result:
print(f"{r['label']}: {r['score']}")