randydev commited on
Commit
2461d54
·
verified ·
1 Parent(s): 947b81f

Update Akeno/plugins/imageai.py

Browse files
Files changed (1) hide show
  1. Akeno/plugins/imageai.py +6 -5
Akeno/plugins/imageai.py CHANGED
@@ -47,19 +47,20 @@ async def schellwithflux(args):
47
  & ~filters.forwarded
48
  )
49
  async def imgfluxai_(client: Client, message: Message):
 
50
  question = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
51
  if not question:
52
- return await message.reply_text("Please provide a question for Flux.")
53
  try:
54
  if not HUGGING_TOKEN:
55
- return await message.reply_text("`HUGGING_TOKEN` is required to use this feature.")
56
  image_bytes = await schellwithflux(question)
57
  if image_bytes is None:
58
- return await message.reply_text("Failed to generate an image.")
59
- pro = await message.reply_text("Generating image, please wait...")
60
  with Image.open(io.BytesIO(image_bytes)) as img:
61
  img.save("testing.jpg", format="JPEG")
62
- ok = await pro.edit_text("Uploading image...")
63
  await message.reply_photo("testing.jpg", progress=progress, progress_args=(ok, time.time(), "Uploading image..."))
64
  await ok.delete()
65
  except Exception as e:
 
47
  & ~filters.forwarded
48
  )
49
  async def imgfluxai_(client: Client, message: Message):
50
+ ok = await message.reply_text("Processing...")
51
  question = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
52
  if not question:
53
+ return await ok.edit_text("Please provide a question for Flux.")
54
  try:
55
  if not HUGGING_TOKEN:
56
+ return await ok.edit_text("`HUGGING_TOKEN` is required to use this feature.")
57
  image_bytes = await schellwithflux(question)
58
  if image_bytes is None:
59
+ return await ok.edit_text("Failed to generate an image.")
60
+ # await ok.edit_text("Generating image, please wait...")
61
  with Image.open(io.BytesIO(image_bytes)) as img:
62
  img.save("testing.jpg", format="JPEG")
63
+ # ok = await ok.edit_text("Uploading image...")
64
  await message.reply_photo("testing.jpg", progress=progress, progress_args=(ok, time.time(), "Uploading image..."))
65
  await ok.delete()
66
  except Exception as e: