test
Browse files
app.py
CHANGED
@@ -27,26 +27,52 @@ intents.message_content = True
|
|
27 |
bot = commands.Bot(command_prefix='!', intents=intents)
|
28 |
|
29 |
#---------------------------------------------------------------------------------------------------------------------------
|
30 |
-
async def
|
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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
await ctx.send(file=discord.File(im))
|
38 |
#---------------------------------------------------------------------------------------------------------------------------
|
39 |
@bot.command()
|
40 |
-
async def
|
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)
|