alanchen1115 commited on
Commit
a6fab3b
Β·
verified Β·
1 Parent(s): 9164af1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -5
main.py CHANGED
@@ -144,12 +144,11 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
144
  if not os.path.exists(image_path):
145
  return "εœ–η‰‡θ·―εΎ‘η„‘ζ•ˆοΌŒη„‘ζ³•ι€²θ‘Œεˆ†ζžγ€‚"
146
 
147
- # img_user = PIL.Image.open(image_path)
148
- print(user_text)
149
  response = genai_client.models.generate_content(
150
- model="gemini-2.5-flash",
151
- contents=f"θ«‹ζ Ήζ“šι€™εΌ΅εœ–η‰‡ε›žη­”ε•ι‘Œγ€‚εœ–η‰‡ηš„θ·―εΎ‘ζ˜―:{image_path}οΌŒζˆ‘ηš„ε•ι‘Œζ˜―:{user_text}"
152
- )
153
 
154
  if (response.text != None):
155
  out = response.text
 
144
  if not os.path.exists(image_path):
145
  return "εœ–η‰‡θ·―εΎ‘η„‘ζ•ˆοΌŒη„‘ζ³•ι€²θ‘Œεˆ†ζžγ€‚"
146
 
147
+ img_user = PIL.Image.open(image_path)
 
148
  response = genai_client.models.generate_content(
149
+ model="gemini-2.5-flash",
150
+ config=types.GenerateContentConfig(response_mime_type="application/json"),
151
+ contents=[img_user, user_text]
152
 
153
  if (response.text != None):
154
  out = response.text