Nicolás Larenas commited on
Commit
4095ff4
·
verified ·
1 Parent(s): 34add1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -1,9 +1,18 @@
1
  import asyncio
 
2
  from discord_bot import run_discord_bot
3
- from gradio_interface import run_gradio_interface
 
 
 
4
 
5
  if __name__ == "__main__":
6
- # Launch both Discord bot and Gradio interface
7
  loop = asyncio.get_event_loop()
8
- loop.create_task(run_discord_bot()) # Start the Discord bot
9
- run_gradio_interface() # Launch Gradio interface
 
 
 
 
 
 
1
  import asyncio
2
+ import nest_asyncio
3
  from discord_bot import run_discord_bot
4
+ from gradio_interface import create_gradio_interface
5
+
6
+ # Apply nest_asyncio to allow nested event loops
7
+ nest_asyncio.apply()
8
 
9
  if __name__ == "__main__":
10
+ # Create the event loop
11
  loop = asyncio.get_event_loop()
12
+
13
+ # Start the Discord bot in the event loop
14
+ loop.create_task(run_discord_bot())
15
+
16
+ # Run the Gradio interface (this will block)
17
+ demo = create_gradio_interface()
18
+ demo.launch(share=True)