From f83f22962271f88fe56d196369a308b589d02f83 Mon Sep 17 00:00:00 2001 From: Ching L Date: Sun, 29 Sep 2024 18:24:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=20=E8=8F=9C=E8=B0=B1=E4=B8=AD?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20cdn=20=E5=9B=BE=E7=89=87=E4=BB=A3=E6=9B=BF?= =?UTF-8?q?=20base64=20=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 945a709..3b294de 100644 --- a/app.py +++ b/app.py @@ -345,8 +345,14 @@ def add_recipe(): if len(step) == 1: description += "
" continue - img = requests.get(step[1]) - img_data = 'data:image/png;base64,' + convert_image_to_base64(img.content) + # img = requests.get(step[1]) + # img_data = 'data:image/png;base64,' + convert_image_to_base64(img.content) + img = upload_image(step[1]) + if img: + img_data = img + else: + img = requests.get(step[1]) + img_data = 'data:image/png;base64,' + convert_image_to_base64(img.content) description += f'\n\n\n' description += "
"