samet214 commited on
Commit
eebaeed
·
verified ·
1 Parent(s): 99b4889

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,13 +6,13 @@ model_name = "savasy/bert-base-turkish-sentiment-cased"
6
  sentiment_pipeline = pipeline("sentiment-analysis", model=model_name)
7
 
8
  def analyze_sentiment(text):
9
- # Modelden tahmini al
10
  result = sentiment_pipeline(text)[0]
11
- # Modelin çıktısını projenin istediği formata (pozitif/nötr/negatif) dönüştür
12
  label = result['label']
13
- if label == "positive":
 
 
14
  return "pozitif"
15
- elif label == "negative":
16
  return "negatif"
17
  else:
18
  return "nötr"
 
6
  sentiment_pipeline = pipeline("sentiment-analysis", model=model_name)
7
 
8
  def analyze_sentiment(text):
 
9
  result = sentiment_pipeline(text)[0]
 
10
  label = result['label']
11
+ score = result['score']
12
+
13
+ if label == "LABEL_1" and score > 0.55:
14
  return "pozitif"
15
+ elif label == "LABEL_0" and score > 0.55:
16
  return "negatif"
17
  else:
18
  return "nötr"