Update app.py
Browse files
app.py
CHANGED
@@ -76,11 +76,9 @@ def chat_get(message: str = "", system_message: str = "You are a friendly Chatbo
|
|
76 |
predict_response = requests.post('http://localhost:7860/call/chat', json={'data': [message, [], system_message, max_tokens, temperature, top_p]}).json()
|
77 |
if "event_id" not in predict_response:
|
78 |
return predict_response
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
).text.rsplit("event: generating\ndata: ", 1)[-1]
|
83 |
-
)[0].strip()])
|
84 |
|
85 |
if __name__ == "__main__":
|
86 |
app = gr.mount_gradio_app(app, demo, path="/")
|
|
|
76 |
predict_response = requests.post('http://localhost:7860/call/chat', json={'data': [message, [], system_message, max_tokens, temperature, top_p]}).json()
|
77 |
if "event_id" not in predict_response:
|
78 |
return predict_response
|
79 |
+
out = requests.get(f'http://localhost:7860/call/chat/{predict_response["event_id"]}').text
|
80 |
+
print(out)
|
81 |
+
return JSONResponse([json.loads(out.rsplit("event: generating\ndata: ", 1)[-1].strip())[0].strip()])
|
|
|
|
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
app = gr.mount_gradio_app(app, demo, path="/")
|