huchiahsi Claude commited on
Commit
d40bc97
·
1 Parent(s): 6ace570

修復 Part.from_text() API 使用錯誤

Browse files

- 在 Part.from_text() 中加入必要的 text= 關鍵字參數
- 解決 'Part.from_text() takes 1 positional argument but 2 were given' 錯誤
- 符合最新的 Google GenAI Python SDK API 規範

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -78,7 +78,7 @@ def analyze_food_calories(image):
78
  types.Content(
79
  role="user",
80
  parts=[
81
- types.Part.from_text(prompt),
82
  types.Part.from_bytes(
83
  data=img_byte_arr,
84
  mime_type="image/png"
 
78
  types.Content(
79
  role="user",
80
  parts=[
81
+ types.Part.from_text(text=prompt),
82
  types.Part.from_bytes(
83
  data=img_byte_arr,
84
  mime_type="image/png"