Spaces:
Runtime error
Runtime error
Enable concurency, make websocket thread safe.
Browse files- app.py +2 -1
- chat_client.py +1 -1
app.py
CHANGED
@@ -131,5 +131,6 @@ with gr.Blocks() as iface:
|
|
131 |
"AI: ", "bloomz", True, 0, 0.9, 0.75, False]
|
132 |
])
|
133 |
|
134 |
-
|
|
|
135 |
iface.launch()
|
|
|
131 |
"AI: ", "bloomz", True, 0, 0.9, 0.75, False]
|
132 |
])
|
133 |
|
134 |
+
# Queues are required to enable generators
|
135 |
+
iface.queue(concurrency_count=5)
|
136 |
iface.launch()
|
chat_client.py
CHANGED
@@ -12,7 +12,7 @@ class ModelClient(object):
|
|
12 |
self.model = None
|
13 |
|
14 |
def open_session(self, model, max_length):
|
15 |
-
self.ws = websocket.create_connection(self.endpoint_url)
|
16 |
self.model = model
|
17 |
payload = {
|
18 |
"type": "open_inference_session",
|
|
|
12 |
self.model = None
|
13 |
|
14 |
def open_session(self, model, max_length):
|
15 |
+
self.ws = websocket.create_connection(self.endpoint_url, enable_multithread=True)
|
16 |
self.model = model
|
17 |
payload = {
|
18 |
"type": "open_inference_session",
|