|
from transformers import pipeline
|
|
import gradio as gr
|
|
|
|
|
|
sentiment_pipeline = pipeline(
|
|
"sentiment-analysis",
|
|
model="savasy/bert-base-turkish-sentiment-cased"
|
|
)
|
|
|
|
|
|
def analyze_sentiment(text):
|
|
result = sentiment_pipeline(text)
|
|
label = result[0]['label']
|
|
score = result[0]['score']
|
|
return f"Duygu: {label}, Güven Skoru: {score:.2f}"
|
|
|
|
|
|
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)."
|
|
)
|
|
|
|
|
|
interface.launch()
|
|
|