Spaces:
Runtime error
Runtime error
Commit
·
c94c8e7
1
Parent(s):
156cdff
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def predict(message, chatbot):
|
|
40 |
}
|
41 |
|
42 |
response = requests.post(api_url, headers=headers, data=json.dumps(data), stream=True)
|
43 |
-
print(response)
|
44 |
|
45 |
partial_message = ""
|
46 |
for line in response.iter_lines():
|
@@ -50,7 +50,7 @@ def predict(message, chatbot):
|
|
50 |
|
51 |
|
52 |
json_line = decoded_line
|
53 |
-
print(decoded_line)
|
54 |
|
55 |
# Remove 'data:' prefix
|
56 |
#if decoded_line.startswith('data:'):
|
@@ -64,7 +64,7 @@ def predict(message, chatbot):
|
|
64 |
# Load as JSON
|
65 |
try:
|
66 |
json_obj = json.loads(json_line)[0]
|
67 |
-
print (json_obj)
|
68 |
if 'generated_text' in json_obj:
|
69 |
partial_message = partial_message + json_obj['generated_text']#['token']['text']
|
70 |
yield partial_message
|
|
|
40 |
}
|
41 |
|
42 |
response = requests.post(api_url, headers=headers, data=json.dumps(data), stream=True)
|
43 |
+
#print(response)
|
44 |
|
45 |
partial_message = ""
|
46 |
for line in response.iter_lines():
|
|
|
50 |
|
51 |
|
52 |
json_line = decoded_line
|
53 |
+
#print(decoded_line)
|
54 |
|
55 |
# Remove 'data:' prefix
|
56 |
#if decoded_line.startswith('data:'):
|
|
|
64 |
# Load as JSON
|
65 |
try:
|
66 |
json_obj = json.loads(json_line)[0]
|
67 |
+
#print (json_obj)
|
68 |
if 'generated_text' in json_obj:
|
69 |
partial_message = partial_message + json_obj['generated_text']#['token']['text']
|
70 |
yield partial_message
|