Spaces:
Running
Running
yuntian-deng
commited on
Commit
•
4f01381
1
Parent(s):
f7b374f
Update app.py
Browse files
app.py
CHANGED
@@ -91,12 +91,17 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:
|
|
91 |
try:
|
92 |
# make a POST request to the API endpoint using the requests.post method, passing in stream=True
|
93 |
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
|
|
|
|
|
|
94 |
response_code = f"{response}"
|
95 |
#if response_code.strip() != "<Response [200]>":
|
96 |
# #print(f"response code - {response}")
|
97 |
# raise Exception(f"Sorry, hitting rate limit. Please try again later. {response}")
|
98 |
|
99 |
for chunk in response.iter_lines():
|
|
|
|
|
100 |
#Skipping first chunk
|
101 |
if counter == 0:
|
102 |
counter += 1
|
|
|
91 |
try:
|
92 |
# make a POST request to the API endpoint using the requests.post method, passing in stream=True
|
93 |
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
94 |
+
print ('r', response)
|
95 |
+
import sys
|
96 |
+
sys.stdout.flush()
|
97 |
response_code = f"{response}"
|
98 |
#if response_code.strip() != "<Response [200]>":
|
99 |
# #print(f"response code - {response}")
|
100 |
# raise Exception(f"Sorry, hitting rate limit. Please try again later. {response}")
|
101 |
|
102 |
for chunk in response.iter_lines():
|
103 |
+
print (chunk)
|
104 |
+
sys.stdout.flush()
|
105 |
#Skipping first chunk
|
106 |
if counter == 0:
|
107 |
counter += 1
|