slush0 commited on
Commit
51cf509
·
1 Parent(s): 79fb1e9

Enable concurency, make websocket thread safe.

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. 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
- iface.queue()
 
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",