Spaces:
Paused
Paused
robinroy03
commited on
Commit
·
cdcece5
1
Parent(s):
fa7f961
Discord bot with gradio on the loop, multi-threaded
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import discord
|
|
2 |
|
3 |
import os
|
4 |
import requests
|
|
|
5 |
|
6 |
intents = discord.Intents.default()
|
7 |
intents.message_content = True
|
@@ -44,17 +45,17 @@ async def on_message(message):
|
|
44 |
print(e)
|
45 |
await message.reply(content="Sorry something internally went wrong. Retry again.")
|
46 |
|
47 |
-
|
48 |
-
|
|
|
49 |
|
50 |
-
def greet():
|
51 |
-
return "Hello"
|
52 |
|
53 |
-
|
54 |
-
fn=greet,
|
55 |
-
inputs=[],
|
56 |
-
outputs=["text"],
|
57 |
-
)
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
import os
|
4 |
import requests
|
5 |
+
import threading
|
6 |
|
7 |
intents = discord.Intents.default()
|
8 |
intents.message_content = True
|
|
|
45 |
print(e)
|
46 |
await message.reply(content="Sorry something internally went wrong. Retry again.")
|
47 |
|
48 |
+
def run_bot():
|
49 |
+
bot.run(token)
|
50 |
+
threading.Thread(target=run_bot).start()
|
51 |
|
|
|
|
|
52 |
|
53 |
+
# ------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
import gradio as gr
|
56 |
+
|
57 |
+
demo = gr.Blocks()
|
58 |
+
with demo:
|
59 |
+
gr.HTML("The bot is working..")
|
60 |
+
|
61 |
+
demo.queue().launch()
|