Spaces:
Paused
Paused
test_deploy: hf spaces hack
Browse files
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
|
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 |
-
|
|
|
|
|
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__':
|