lunarflu HF Staff commited on
Commit
2d3687c
Β·
1 Parent(s): 0a57242
Files changed (1) hide show
  1. app.py +49 -5
app.py CHANGED
@@ -27,26 +27,52 @@ intents.message_content = True
27
  bot = commands.Bot(command_prefix='!', intents=intents)
28
 
29
  #---------------------------------------------------------------------------------------------------------------------------
30
- async def generate_jojo_image(ctx, attachment):
31
  start_time = time.time()
32
  style = 'JoJo'
 
 
 
 
 
 
 
 
 
 
33
  im = jojogan.predict(attachment.url, style)
34
  end_time = time.time()
35
  generation_time = end_time - start_time
36
- await ctx.send(f"Jojo image generated in {generation_time:.2f} seconds.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  await ctx.send(file=discord.File(im))
38
  #---------------------------------------------------------------------------------------------------------------------------
39
  @bot.command()
40
- async def jojo(ctx):
41
  if ctx.message.attachments:
42
  attachment = ctx.message.attachments[0]
43
  await ctx.message.add_reaction('πŸ€–')
44
  await ctx.message.add_reaction('βŒ›')
45
 
46
- # Run the image generation asynchronously
47
  task = asyncio.create_task(generate_jojo_image(ctx, attachment))
48
 
49
- # Wait for the task to complete before proceeding
50
  await task
51
 
52
  await ctx.message.remove_reaction('βŒ›', bot.user)
@@ -55,6 +81,24 @@ async def jojo(ctx):
55
  await ctx.send(f"{ctx.author.mention} No attachments to be found... Can't animify dat! Try sending me an image πŸ˜‰")
56
  await ctx.message.add_reaction('❌')
57
  #----------------------------------------------------------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  def run_bot():
60
  bot.run(DISCORD_TOKEN)
 
27
  bot = commands.Bot(command_prefix='!', intents=intents)
28
 
29
  #---------------------------------------------------------------------------------------------------------------------------
30
+ async def jojo(ctx):
31
  start_time = time.time()
32
  style = 'JoJo'
33
+ atchurl = 'https://cdn.discordapp.com/attachments/1100458786826747945/1111746037640601610/image.png'
34
+ im = jojogan.predict(atchurl, style)
35
+ end_time = time.time()
36
+ generation_time = end_time - start_time
37
+ await ctx.send(f"{style} image generated in {generation_time:.2f} seconds.")
38
+ await ctx.send(file=discord.File(im))
39
+ #---------------------------------------------------------------------------------------------------------------------------
40
+ async def spiderverse(ctx, attachment):
41
+ start_time = time.time()
42
+ style = 'Spider-Verse'
43
  im = jojogan.predict(attachment.url, style)
44
  end_time = time.time()
45
  generation_time = end_time - start_time
46
+ await ctx.send(f"{style} image generated in {generation_time:.2f} seconds.")
47
+ await ctx.send(file=discord.File(im))
48
+ #---------------------------------------------------------------------------------------------------------------------------
49
+ async def disney(ctx, attachment):
50
+ start_time = time.time()
51
+ style = 'disney'
52
+ im = jojogan.predict(attachment.url, style)
53
+ end_time = time.time()
54
+ generation_time = end_time - start_time
55
+ await ctx.send(f"{style} image generated in {generation_time:.2f} seconds.")
56
+ await ctx.send(file=discord.File(im))
57
+ #---------------------------------------------------------------------------------------------------------------------------
58
+ async def sketch(ctx, attachment):
59
+ start_time = time.time()
60
+ style = 'sketch'
61
+ im = jojogan.predict(attachment.url, style)
62
+ end_time = time.time()
63
+ generation_time = end_time - start_time
64
+ await ctx.send(f"{style} image generated in {generation_time:.2f} seconds.")
65
  await ctx.send(file=discord.File(im))
66
  #---------------------------------------------------------------------------------------------------------------------------
67
  @bot.command()
68
+ async def jojo2(ctx):
69
  if ctx.message.attachments:
70
  attachment = ctx.message.attachments[0]
71
  await ctx.message.add_reaction('πŸ€–')
72
  await ctx.message.add_reaction('βŒ›')
73
 
 
74
  task = asyncio.create_task(generate_jojo_image(ctx, attachment))
75
 
 
76
  await task
77
 
78
  await ctx.message.remove_reaction('βŒ›', bot.user)
 
81
  await ctx.send(f"{ctx.author.mention} No attachments to be found... Can't animify dat! Try sending me an image πŸ˜‰")
82
  await ctx.message.add_reaction('❌')
83
  #----------------------------------------------------------------------------------------------------------------------------
84
+ @bot.command()
85
+ async def run_commands(ctx):
86
+ await ctx.send("running 4 commands...")
87
+
88
+ task1 = asyncio.create_task(jojo(ctx))
89
+ task2 = asyncio.create_task(jojo(ctx))
90
+ task3 = asyncio.create_task(jojo(ctx))
91
+ task4 = asyncio.create_task(jojo(ctx))
92
+
93
+ await asyncio.gather(task1, task2, task3, task4)
94
+
95
+ await ctx.send("All commands completed.")
96
+ #----------------------------------------------------------------------------------------------------------------------------
97
+
98
+
99
+
100
+
101
+
102
 
103
  def run_bot():
104
  bot.run(DISCORD_TOKEN)