[tasks] time for generations
Browse files
app.py
CHANGED
@@ -13,12 +13,11 @@ from gradio_client import Client
|
|
13 |
from PIL import Image
|
14 |
#from ratelimiter import RateLimiter
|
15 |
import asyncio
|
16 |
-
|
17 |
|
18 |
DFIF_TOKEN = os.getenv('HF_TOKEN')
|
19 |
DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
|
20 |
|
21 |
-
df = Client("huggingface-projects/IF", DFIF_TOKEN)
|
22 |
jojogan = Client("akhaliq/JoJoGAN", DFIF_TOKEN)
|
23 |
|
24 |
|
@@ -29,10 +28,13 @@ bot = commands.Bot(command_prefix='!', intents=intents)
|
|
29 |
|
30 |
#---------------------------------------------------------------------------------------------------------------------------
|
31 |
async def generate_jojo_image(ctx, attachment):
|
|
|
32 |
style = 'JoJo'
|
33 |
im = jojogan.predict(attachment.url, style)
|
34 |
-
await ctx.send(f
|
35 |
await ctx.send(file=discord.File(im))
|
|
|
|
|
36 |
#---------------------------------------------------------------------------------------------------------------------------
|
37 |
@bot.command()
|
38 |
async def jojo(ctx):
|
|
|
13 |
from PIL import Image
|
14 |
#from ratelimiter import RateLimiter
|
15 |
import asyncio
|
16 |
+
|
17 |
|
18 |
DFIF_TOKEN = os.getenv('HF_TOKEN')
|
19 |
DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
|
20 |
|
|
|
21 |
jojogan = Client("akhaliq/JoJoGAN", DFIF_TOKEN)
|
22 |
|
23 |
|
|
|
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 |
+
await ctx.send(f"Jojo image generated in {generation_time:.2f} seconds.")
|
35 |
await ctx.send(file=discord.File(im))
|
36 |
+
end_time = time.time()
|
37 |
+
total_time = end_time - start_time
|
38 |
#---------------------------------------------------------------------------------------------------------------------------
|
39 |
@bot.command()
|
40 |
async def jojo(ctx):
|