Araeynn commited on
Commit
10da731
1 Parent(s): 3b1ffb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -92,6 +92,7 @@ SDT = AsyncInferenceClient(model=sd_turbo)
92
  PT = AsyncInferenceClient(model=proteus)
93
  LLM = AsyncInferenceClient(model="openchat/openchat-3.5-0106")
94
  RF = AsyncInferenceClient(model="stabilityai/stable-diffusion-xl-refiner-1.0")
 
95
 
96
 
97
  def ec(x, fd="<|image|>", sd="<|image|>"):
@@ -403,20 +404,30 @@ async def on_message(message):
403
  if imgp != "":
404
  np = """lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"""
405
  st = time.time()
406
- image = await SD.text_to_image(imgp, negative_prompt=np)
 
407
  image.save("image.png")
 
 
 
408
  embed.set_footer(
409
  text=
410
- """Refining..."""
411
  )
 
 
412
  file = discord.File("image.png", filename="image.png", description=imgp)
413
  embed.set_image(url="attachment://image.png")
 
 
 
 
414
  await e.edit(embed=embed, attachments=[file])
415
  image = await RF.image_to_image("image.png", num_inference_steps=5)
416
  et = time.time()
417
  embed.set_footer(
418
  text=
419
- f"Took {et - st} seconds to generate."
420
  )
421
  image.save("image.png")
422
  file = discord.File("image.png", filename="image.png")
 
92
  PT = AsyncInferenceClient(model=proteus)
93
  LLM = AsyncInferenceClient(model="openchat/openchat-3.5-0106")
94
  RF = AsyncInferenceClient(model="stabilityai/stable-diffusion-xl-refiner-1.0")
95
+ UP = AsyncInferenceClient("radames/sd-x2-latent-upscaler-img2img")
96
 
97
 
98
  def ec(x, fd="<|image|>", sd="<|image|>"):
 
404
  if imgp != "":
405
  np = """lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"""
406
  st = time.time()
407
+ image, m = (await SD.text_to_image(imgp, negative_prompt=np), "Stable Diffusion 2-1")
408
+ # image, m = (await SDXL.text_to_image(imgp, negative_prompt=np), "stable-diffusion-xl-base-1.0")
409
  image.save("image.png")
410
+ file = discord.File("image.png", filename="image.png", description=imgp)
411
+ embed.set_image(url="attachment://image.png")
412
+ await e.edit(embed=embed, attachments=[file])
413
  embed.set_footer(
414
  text=
415
+ """Upscaling..."""
416
  )
417
+ image = await UP.image_to_image("image.png")
418
+ image.save("image.png")
419
  file = discord.File("image.png", filename="image.png", description=imgp)
420
  embed.set_image(url="attachment://image.png")
421
+ embed.set_footer(
422
+ text=
423
+ """Refining..."""
424
+ )
425
  await e.edit(embed=embed, attachments=[file])
426
  image = await RF.image_to_image("image.png", num_inference_steps=5)
427
  et = time.time()
428
  embed.set_footer(
429
  text=
430
+ f"Image generation model is {m}. Took {et - st} seconds to generate."
431
  )
432
  image.save("image.png")
433
  file = discord.File("image.png", filename="image.png")