lunarflu HF Staff commited on
Commit
e321cce
·
1 Parent(s): 0ee5086
Files changed (1) hide show
  1. app.py +27 -8
app.py CHANGED
@@ -142,7 +142,7 @@ async def deepfloydif_generate64(ctx, prompt):
142
  try:
143
  channel = ctx.channel
144
  # interaction.response message can't be used to create a thread, so we create another message
145
- message = await ctx.send(f"**{prompt}** - {ctx.author.mention} <a:loading:1114111677990981692>")
146
 
147
  loop = asyncio.get_running_loop()
148
  result = await loop.run_in_executor(None, deepfloydif_generate64_inference, prompt)
@@ -177,7 +177,7 @@ async def deepfloydif_generate64(ctx, prompt):
177
  index = int(interaction.data["custom_id"]) # 0,1,2,3
178
 
179
  await interaction.response.send_message(
180
- f"{interaction.user.mention} <a:loading:1114111677990981692>", ephemeral=True
181
  )
182
  result_path = await deepfloydif_upscale256(index, path_for_upscale256_upscaling)
183
 
@@ -202,7 +202,7 @@ async def deepfloydif_generate64(ctx, prompt):
202
  index = int(interaction.data["custom_id"])
203
 
204
  await interaction.response.send_message(
205
- f"{interaction.user.mention} <a:loading:1114111677990981692>", ephemeral=True
206
  )
207
  result_path = await deepfloydif_upscale1024(index, path_for_upscale256_upscaling, prompt)
208
 
@@ -268,13 +268,32 @@ def run_bot():
268
 
269
 
270
  threading.Thread(target=run_bot).start()
271
- """This allows us to run the Discord bot in a Python thread"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  with gr.Blocks() as demo:
273
- gr.Markdown("""
274
- # Huggingbots Server
275
- This space hosts the huggingbots discord bot.
276
- Currently supported models are Falcon and DeepfloydIF
277
  """)
 
 
278
  demo.queue(concurrency_count=100)
279
  demo.queue(max_size=100)
280
  demo.launch()
 
142
  try:
143
  channel = ctx.channel
144
  # interaction.response message can't be used to create a thread, so we create another message
145
+ message = await ctx.send(f"**{prompt}** - {ctx.author.mention} (generating...)")
146
 
147
  loop = asyncio.get_running_loop()
148
  result = await loop.run_in_executor(None, deepfloydif_generate64_inference, prompt)
 
177
  index = int(interaction.data["custom_id"]) # 0,1,2,3
178
 
179
  await interaction.response.send_message(
180
+ f"{interaction.user.mention} (upscaling...)", ephemeral=True
181
  )
182
  result_path = await deepfloydif_upscale256(index, path_for_upscale256_upscaling)
183
 
 
202
  index = int(interaction.data["custom_id"])
203
 
204
  await interaction.response.send_message(
205
+ f"{interaction.user.mention} (upscaling...)", ephemeral=True
206
  )
207
  result_path = await deepfloydif_upscale1024(index, path_for_upscale256_upscaling, prompt)
208
 
 
268
 
269
 
270
  threading.Thread(target=run_bot).start()
271
+
272
+
273
+ welcome_message = """
274
+ ## Add this bot to your server by clicking this link:
275
+
276
+ https://discord.com/api/oauth2/authorize?client_id=1154395078735953930&permissions=51200&scope=bot
277
+
278
+ ## How to use it?
279
+
280
+ The bot can be triggered via `/deepfloydif` followed by your text prompt.
281
+
282
+ This will generate images based on the text prompt. You can upscale the images using the buttons, for up to 16x the detail!
283
+
284
+ ⚠️ Note ⚠️: Please make sure this bot's command does have the same name as another command in your server.
285
+
286
+ ⚠️ Note ⚠️: Bot commands do not work in DMs with the bot as of now.
287
+ """
288
+
289
+
290
  with gr.Blocks() as demo:
291
+ gr.Markdown(f"""
292
+ # Discord bot of https://huggingface.co/spaces/DeepFloyd/IF
293
+ {welcome_message}
 
294
  """)
295
+
296
+
297
  demo.queue(concurrency_count=100)
298
  demo.queue(max_size=100)
299
  demo.launch()