sinemciftcidemirci commited on
Commit
d6c6587
·
verified ·
1 Parent(s): 880d1c8

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +27 -7
  2. requirements.txt +3 -0
app.py CHANGED
@@ -1,7 +1,27 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Hugging Face'den Türkçe Sentiment Analysis Pipeline Yükleme
5
+ sentiment_pipeline = pipeline(
6
+ "sentiment-analysis",
7
+ model="savasy/bert-base-turkish-sentiment-cased"
8
+ )
9
+
10
+ # Analiz Fonksiyonu
11
+ def analyze_sentiment(text):
12
+ result = sentiment_pipeline(text)
13
+ label = result[0]['label'] # Pozitif/Negatif
14
+ score = result[0]['score'] # Güven skoru
15
+ return f"Duygu: {label}, Güven Skoru: {score:.2f}"
16
+
17
+ # Gradio Arayüzü
18
+ interface = gr.Interface(
19
+ fn=analyze_sentiment,
20
+ inputs="text",
21
+ outputs="text",
22
+ title="Türkçe Duygu Analizi",
23
+ description="Bir cümle girin ve Türkçe duygu analizini yapın (Pozitif, Negatif, Nötr)."
24
+ )
25
+
26
+ # Uygulamayı Başlat
27
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio