Update main.py
Browse files
main.py
CHANGED
|
@@ -12,8 +12,7 @@ import io
|
|
| 12 |
import PIL.Image
|
| 13 |
|
| 14 |
from imgurpython import ImgurClient
|
| 15 |
-
from Image_generation import
|
| 16 |
-
|
| 17 |
from Uploading_images import get_image_url, store_user_message, analyze_with_gemini, get_previous_message
|
| 18 |
|
| 19 |
#==========================
|
|
@@ -101,14 +100,13 @@ def handle_image_message(event):
|
|
| 101 |
|
| 102 |
# ๅ
็ซๅณๅ่ฆ้ฟๅ
token้ๆ
|
| 103 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="ๅ็็ๆไธญ๏ฝ ่ซ็จๅ.....โจ"))
|
| 104 |
-
client = ImgurClient(client_id, client_secret, access_token, refresh_token)
|
| 105 |
|
| 106 |
# ็ๆๅ็
|
| 107 |
-
image_binary = generate_image_with_gemini(prompt)
|
| 108 |
|
| 109 |
if image_binary:
|
| 110 |
album = "nvsYwgq"
|
| 111 |
-
image_url = upload_image_to_imgur(
|
| 112 |
|
| 113 |
if image_url:
|
| 114 |
# ไฝฟ็จ push message ็ผ้ๅ็๏ผ้ฟๅ
reply token ่ถ
ๆ
|
|
|
|
| 12 |
import PIL.Image
|
| 13 |
|
| 14 |
from imgurpython import ImgurClient
|
| 15 |
+
from Image_generation import ImageGenerator
|
|
|
|
| 16 |
from Uploading_images import get_image_url, store_user_message, analyze_with_gemini, get_previous_message
|
| 17 |
|
| 18 |
#==========================
|
|
|
|
| 100 |
|
| 101 |
# ๅ
็ซๅณๅ่ฆ้ฟๅ
token้ๆ
|
| 102 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="ๅ็็ๆไธญ๏ฝ ่ซ็จๅ.....โจ"))
|
|
|
|
| 103 |
|
| 104 |
# ็ๆๅ็
|
| 105 |
+
image_binary = image_generator.generate_image_with_gemini(prompt)
|
| 106 |
|
| 107 |
if image_binary:
|
| 108 |
album = "nvsYwgq"
|
| 109 |
+
image_url = image_generator.upload_image_to_imgur(image_binary,album)
|
| 110 |
|
| 111 |
if image_url:
|
| 112 |
# ไฝฟ็จ push message ็ผ้ๅ็๏ผ้ฟๅ
reply token ่ถ
ๆ
|