| # app.py | |
| import asyncio | |
| import nest_asyncio | |
| from gradio_interface import create_gradio_interface | |
| from discord_bot import run_discord_bot | |
| # Apply nest_asyncio to allow nested event loops | |
| nest_asyncio.apply() | |
| if __name__ == "__main__": | |
| # Create the event loop | |
| loop = asyncio.get_event_loop() | |
| # Start the Discord bot in the event loop | |
| loop.create_task(run_discord_bot()) | |
| # Create and launch the Gradio interface | |
| demo = create_gradio_interface() | |
| demo.launch() | |