Update main.py
Browse files
main.py
CHANGED
|
@@ -198,10 +198,12 @@ def handle_image_message(event):
|
|
| 198 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="圖片生成中~ 請稍候.....✨"))
|
| 199 |
client = ImgurClient(client_id, client_secret, access_token, refresh_token)
|
| 200 |
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
| 205 |
|
| 206 |
if image_binary:
|
| 207 |
album = "nvsYwgq"
|
|
|
|
| 198 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="圖片生成中~ 請稍候.....✨"))
|
| 199 |
client = ImgurClient(client_id, client_secret, access_token, refresh_token)
|
| 200 |
|
| 201 |
+
translator = pipeline("translation", model='Helsinki-NLP/opus-mt-zh-en')
|
| 202 |
+
translation = translator(prompt_zh)
|
| 203 |
+
prompt_en = translation[0]['translation_text']
|
| 204 |
+
|
| 205 |
+
# 生成圖片
|
| 206 |
+
image_binary = generate_image_hf(prompt_en)
|
| 207 |
|
| 208 |
if image_binary:
|
| 209 |
album = "nvsYwgq"
|