Spaces:
Running
Running
| import gradio as gr | |
| from transformers import pipeline | |
| model_name = "ZombitX64/Thai-sentiment-e5" # เปลี่ยนเป็นชื่อโมเดลของคุณ | |
| nlp = pipeline("sentiment-analysis", model=model_name) | |
| def analyze_text(text): | |
| result = nlp(text)[0] | |
| return f"ผลวิเคราะห์: {result['label']} (ความมั่นใจ {result['score']:.2f})" | |
| demo = gr.Interface( | |
| fn=analyze_text, | |
| inputs=gr.Textbox(lines=3, placeholder="พิมพ์ข้อความที่นี่..."), | |
| outputs="text", | |
| title="แอปวิเคราะห์ข้อความภาษาไทย" | |
| ) | |
| demo.launch() | |