Evaaaaa06 commited on
Commit
c1a9cde
·
verified ·
1 Parent(s): 10ee8eb

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -99,8 +99,8 @@ def analyze_with_gemini(image_path, user_text):
99
  raise FileNotFoundError(f"圖片路徑無效:{image_path}")
100
 
101
  # 打開本地圖片文件並將其轉換為 Base64 編碼
102
- with open(image_path, "rb") as image_file:
103
- image_binary = image_file.read()
104
 
105
  # 將二進制數據編碼為 Base64
106
  image_base64 = base64.b64encode(image_binary).decode('utf-8')
 
99
  raise FileNotFoundError(f"圖片路徑無效:{image_path}")
100
 
101
  # 打開本地圖片文件並將其轉換為 Base64 編碼
102
+ with open(image_path, "rb") as image_file:
103
+ image_binary = image_file.read()
104
 
105
  # 將二進制數據編碼為 Base64
106
  image_base64 = base64.b64encode(image_binary).decode('utf-8')