Spaces:
Sleeping
Sleeping
| 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() | |