820nam's picture
Rename main.py to app.py
1a0689b verified
raw
history blame contribute delete
589 Bytes
import gradio as gr
from transformers import pipeline
# ๊ฐ์ • ๋ถ„์„ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.
classifier = pipeline("sentiment-analysis")
# ์˜ˆ์ธก ํ•จ์ˆ˜ ์ •์˜
def sentiment_analysis(text):
result = classifier(text)[0]
label = result['label']
score = result['score']
return f"Label: {label}, Score: {score:.2f}"
# Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
iface = gr.Interface(
fn=sentiment_analysis,
inputs="text",
outputs="text",
title="Sentiment Analysis",
description="Enter text to analyze its sentiment.",
)
# ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰
iface.launch()