Katake commited on
Commit
da2abdc
·
verified ·
1 Parent(s): c147591

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -15
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
3
 
4
- # Modeli 1 kez yükle (hız için)
5
  model = AutoModelForSequenceClassification.from_pretrained(
6
  "savasy/bert-base-turkish-sentiment-cased"
7
  )
@@ -21,28 +21,24 @@ def analyze(text):
21
  return "🔵 POZİTİF"
22
  elif result == "negative":
23
  return "🔴 NEGATİF"
24
- else:
25
- return "🟡 NÖTR"
26
 
27
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
28
  gr.Markdown(
29
  """
30
  # 🇹🇷 Türkçe Duygu Analizi
31
- BERT tabanlı Türkçe cümle analiz modeli
32
-
33
- Bir cümle yaz → Model sana **POZİTİF / NEGATİF / NÖTR** sonucunu söylesin.
34
  """
35
  )
36
 
37
- with gr.Row():
38
- text_input = gr.Textbox(
39
- label="Cümle",
40
- placeholder="Bir cümle yazınız...",
41
- lines=4
42
- )
43
-
44
  analyze_button = gr.Button("Analiz Et")
45
-
46
  output = gr.Textbox(
47
  label="Duygu Sonucu",
48
  interactive=False
 
1
  import gradio as gr
2
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
3
 
4
+ # Modeli tek sefer yükle
5
  model = AutoModelForSequenceClassification.from_pretrained(
6
  "savasy/bert-base-turkish-sentiment-cased"
7
  )
 
21
  return "🔵 POZİTİF"
22
  elif result == "negative":
23
  return "🔴 NEGATİF"
24
+ return "🟡 NÖTR"
 
25
 
26
+ with gr.Blocks() as demo:
27
  gr.Markdown(
28
  """
29
  # 🇹🇷 Türkçe Duygu Analizi
30
+ Bir cümle yaz Model sonucu göstersin.
 
 
31
  """
32
  )
33
 
34
+ text_input = gr.Textbox(
35
+ label="Cümle",
36
+ placeholder="Bir cümle yazınız...",
37
+ lines=4
38
+ )
39
+
 
40
  analyze_button = gr.Button("Analiz Et")
41
+
42
  output = gr.Textbox(
43
  label="Duygu Sonucu",
44
  interactive=False