File size: 788 Bytes
d6c6587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from transformers import pipeline
import gradio as gr

# Hugging Face'den Türkçe Sentiment Analysis Pipeline Yükleme
sentiment_pipeline = pipeline(
    "sentiment-analysis",
    model="savasy/bert-base-turkish-sentiment-cased"
)

# Analiz Fonksiyonu
def analyze_sentiment(text):
    result = sentiment_pipeline(text)
    label = result[0]['label']  # Pozitif/Negatif
    score = result[0]['score']  # Güven skoru
    return f"Duygu: {label}, Güven Skoru: {score:.2f}"

# Gradio Arayüzü
interface = gr.Interface(
    fn=analyze_sentiment,
    inputs="text",
    outputs="text",
    title="Türkçe Duygu Analizi",
    description="Bir cümle girin ve Türkçe duygu analizini yapın (Pozitif, Negatif, Nötr)."
)

# Uygulamayı Başlat
interface.launch()