Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
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:
|