| import gradio as gr | |
| from transformers import pipeline | |
| sentiment_analyzer = pipeline("sentiment-analysis") | |
| def analyze_sentiment(text): | |
| result = sentiment_analyzer(text)[0] | |
| return f"ๆๆ : {result['label']}, ็ขบไฟกๅบฆ: {result['score']:.2f}" | |
| iface = gr.Interface( | |
| fn=analyze_sentiment, | |
| inputs="text", | |
| outputs="text", | |
| title="็ฐกๅใชๆๆ ๅๆ", | |
| description="ใใญในใใๅ ฅๅใใฆใใใฎๆๆ ใๅๆใใพใใ" | |
| ) | |
| iface.launch() |