lunarflu HF Staff commited on
Commit
75dfc1c
·
1 Parent(s): d48cc05

[tasks] time for generations

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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
- import shutil # for doing image movement magic
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'{ctx.author.mention} Here is the {style} version of it')
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):