MWilinski commited on
Commit
2bb4089
·
1 Parent(s): c893d6c

test_deploy: hf spaces hack

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
 
3
  from qa_engine import logger, Config, QAEngine
4
  from discord_bot import DiscordClient
 
5
 
6
 
7
  config = Config()
@@ -35,7 +36,7 @@ def gradio_interface():
35
  demo.launch(share=True)
36
 
37
 
38
- def discord_bot():
39
  client = DiscordClient(
40
  qa_engine=qa_engine,
41
  num_last_messages=config.num_last_messages,
@@ -43,9 +44,16 @@ def discord_bot():
43
  enable_commands=config.enable_commands,
44
  debug=config.debug
45
  )
 
 
 
 
 
46
  with gr.Blocks() as demo:
47
  gr.Markdown(f'Discord bot is running.')
48
- client.run(config.discord_token)
 
 
49
 
50
 
51
  if __name__ == '__main__':
 
2
 
3
  from qa_engine import logger, Config, QAEngine
4
  from discord_bot import DiscordClient
5
+ import threading
6
 
7
 
8
  config = Config()
 
36
  demo.launch(share=True)
37
 
38
 
39
+ def discord_bot_inference_thread():
40
  client = DiscordClient(
41
  qa_engine=qa_engine,
42
  num_last_messages=config.num_last_messages,
 
44
  enable_commands=config.enable_commands,
45
  debug=config.debug
46
  )
47
+ client.run(config.discord_token)
48
+
49
+ def discord_bot():
50
+ thread = threading.Thread(target=discord_bot_inference_thread)
51
+ thread.start()
52
  with gr.Blocks() as demo:
53
  gr.Markdown(f'Discord bot is running.')
54
+ demo.queue(concurrency_count=100)
55
+ demo.queue(max_size=100)
56
+ demo.launch()
57
 
58
 
59
  if __name__ == '__main__':