lunarflu HF Staff commited on
Commit
dbb572b
·
1 Parent(s): d152a27

reverted to original run bot in thread structure

Browse files
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -69,22 +69,10 @@ async def command(ctx, num_requests: int):
69
  def run_bot():
70
  bot.run(DISCORD_TOKEN)
71
 
 
72
 
73
- async def run_gradio_interface():
74
- def greet(name):
75
- return "Hello " + name + "!"
76
 
77
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
78
- await demo.launch()
79
-
80
-
81
- async def main():
82
- loop = asyncio.get_event_loop()
83
- tasks = [
84
- loop.create_task(run_bot()),
85
- loop.create_task(run_gradio_interface())
86
- ]
87
- await asyncio.wait(tasks)
88
-
89
-
90
- asyncio.run(main())
 
69
  def run_bot():
70
  bot.run(DISCORD_TOKEN)
71
 
72
+ threading.Thread(target=run_bot).start()
73
 
74
+ def greet(name):
75
+ return "Hello " + name + "!"
 
76
 
77
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
78
+ demo.launch()