randydev commited on
Commit
a369831
·
verified ·
1 Parent(s): d1b1632
Files changed (1) hide show
  1. akn/Gemini/gemini.py +9 -4
akn/Gemini/gemini.py CHANGED
@@ -331,7 +331,9 @@ async def chatbot_talk(client: Client, message: Message):
331
  file_path = "randydev.jpg"
332
  with open(file_path, "wb") as f:
333
  f.write(response_js)
334
- await new_js.edit_text("Uploading image...")
 
 
335
  await message.reply_photo(
336
  file_path,
337
  progress=progress,
@@ -341,11 +343,12 @@ async def chatbot_talk(client: Client, message: Message):
341
  "Uploading image..."
342
  )
343
  )
344
- backup_chat.append({"role": "model", "parts": [{"text": f"IMAGE OUTPUT: {query_base}"}]})
345
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
346
  await new_js.delete()
347
  return
348
  except ImageProcessFailed as e:
 
349
  await new_js.edit_text("Please wait, Error try still processing...")
350
  response_js = await js.image.create(
351
  "black-forest-labs/flux-1-schnell",
@@ -355,7 +358,9 @@ async def chatbot_talk(client: Client, message: Message):
355
  file_path = "randydev.jpg"
356
  with open(file_path, "wb") as f:
357
  f.write(response_js)
358
- await new_js.edit_text("Uploading image...")
 
 
359
  await message.reply_photo(
360
  file_path,
361
  progress=progress,
@@ -365,7 +370,7 @@ async def chatbot_talk(client: Client, message: Message):
365
  "Uploading image..."
366
  )
367
  )
368
- backup_chat.append({"role": "model", "parts": [{"text": f"IMAGE OUTPUT: {query_base}"}]})
369
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
370
  await new_js.delete()
371
  return
 
331
  file_path = "randydev.jpg"
332
  with open(file_path, "wb") as f:
333
  f.write(response_js)
334
+ await new_js.edit_text("Uploading image completed...")
335
+ x = GeminiLatest(api_keys=GOOGLE_API_KEY)
336
+ response_reads = x.get_response_image("What this?", file_path)
337
  await message.reply_photo(
338
  file_path,
339
  progress=progress,
 
343
  "Uploading image..."
344
  )
345
  )
346
+ backup_chat.append({"role": "model", "parts": [{"text": response_reads}]})
347
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
348
  await new_js.delete()
349
  return
350
  except ImageProcessFailed as e:
351
+ backup_chat.append({"role": "user", "parts": [{"text": query_base}]})
352
  await new_js.edit_text("Please wait, Error try still processing...")
353
  response_js = await js.image.create(
354
  "black-forest-labs/flux-1-schnell",
 
358
  file_path = "randydev.jpg"
359
  with open(file_path, "wb") as f:
360
  f.write(response_js)
361
+ await new_js.edit_text("Uploading image completed...")
362
+ x = GeminiLatest(api_keys=GOOGLE_API_KEY)
363
+ response_reads = x.get_response_image("What this?", file_path)
364
  await message.reply_photo(
365
  file_path,
366
  progress=progress,
 
370
  "Uploading image..."
371
  )
372
  )
373
+ backup_chat.append({"role": "model", "parts": [{"text": response_reads}]})
374
  await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
375
  await new_js.delete()
376
  return