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 θΆ
ζ
|