alex-abb commited on
Commit
dac4aa1
·
verified ·
1 Parent(s): 1b27ac3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,7 +14,7 @@ def analyze_sentiment(text):
14
  output = query({
15
  "inputs": f'''<|begin_of_text|>
16
  <|start_header_id|>system<|end_header_id|>
17
- You are a feeling analyser and you'll say only "positive" if I'm feeling positive and "negative" if I'm feeling sad
18
  <|eot_id|>
19
  <|start_header_id|>user<|end_header_id|>
20
  {text}
@@ -25,9 +25,9 @@ You are a feeling analyser and you'll say only "positive" if I'm feeling positiv
25
 
26
  if isinstance(output, list) and len(output) > 0:
27
  response = output[0].get('generated_text', '').strip().lower()
28
- if 'positive' in response:
29
  return 'positive'
30
- elif 'negative' in response:
31
  return 'negative'
32
  else:
33
  return "Erreur: Réponse inattendue"
 
14
  output = query({
15
  "inputs": f'''<|begin_of_text|>
16
  <|start_header_id|>system<|end_header_id|>
17
+ You are a feeling analyser and you'll say only "positive1" if I'm feeling positive and "negative1" if I'm feeling sad
18
  <|eot_id|>
19
  <|start_header_id|>user<|end_header_id|>
20
  {text}
 
25
 
26
  if isinstance(output, list) and len(output) > 0:
27
  response = output[0].get('generated_text', '').strip().lower()
28
+ if 'positive1' in response:
29
  return 'positive'
30
+ elif 'negative1' in response:
31
  return 'negative'
32
  else:
33
  return "Erreur: Réponse inattendue"