Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Modeli yükle | |
| classifier = pipeline( | |
| "sentiment-analysis", | |
| model="saribasmetehan/bert-base-turkish-sentiment-analysis" | |
| ) | |
| # Fonksiyon | |
| def analyze_sentiment(text): | |
| result = classifier(text)[0] | |
| label_map = { | |
| "LABEL_0": "Nötr", | |
| "LABEL_1": "Pozitif", | |
| "LABEL_2": "Negatif" | |
| } | |
| return label_map.get(result['label'], result['label']) | |
| # Gradio arayüzü | |
| iface = gr.Interface( | |
| fn=analyze_sentiment, | |
| inputs=gr.Textbox(lines=3, placeholder="Metni buraya yazın..."), | |
| outputs="text", | |
| title="Türkçe Duygu Analizi", | |
| description="Bu uygulama verilen Türkçe metni Pozitif, Nötr veya Negatif olarak sınıflandırır." | |
| ) | |
| iface.launch() | |