alex-abb commited on
Commit
49c5437
·
verified ·
1 Parent(s): 47f2ac0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -12,17 +12,20 @@ def query(payload):
12
  return response.json()
13
 
14
 
 
 
15
  def analyze_sentiment(text):
16
-
17
-
18
  output = query({
19
- "inputs": {
20
-
21
-
22
- "<|start_header_id|>{system}<|end_header_id|>": "you'll only answer in english",
23
- "<|start_header_id|>{user}<|end_header_id|>": text
24
- }
25
- })
 
 
 
26
 
27
  # Assurez-vous de gérer correctement la sortie de l'API
28
  if isinstance(output, list) and len(output) > 0:
 
12
  return response.json()
13
 
14
 
15
+
16
+
17
  def analyze_sentiment(text):
 
 
18
  output = query({
19
+ "inputs": f'''<|begin_of_text|>
20
+ <|start_header_id|>system<|end_header_id|>
21
+ You'll only answer in English.
22
+ <|eot_id|>
23
+ <|start_header_id|>user<|end_header_id|>
24
+ {text}
25
+ <|eot_id|>
26
+ <|start_header_id|>assistant<|end_header_id|>
27
+ '''
28
+ })
29
 
30
  # Assurez-vous de gérer correctement la sortie de l'API
31
  if isinstance(output, list) and len(output) > 0: