Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -139,7 +139,7 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
|
|
| 139 |
return "錯誤:找不到該圖片檔案。"
|
| 140 |
img_user = PIL.Image.open(image_path)
|
| 141 |
response = genai_client.models.generate_content(
|
| 142 |
-
model="gemini-
|
| 143 |
contents=[img_user, user_text]
|
| 144 |
)
|
| 145 |
return response.text if response.text else "Gemini 沒答案!"
|
|
@@ -151,7 +151,7 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
|
|
| 151 |
# ==========================
|
| 152 |
tools = [generate_and_upload_image, analyze_image_with_text]
|
| 153 |
# 1. 建立 LLM 模型
|
| 154 |
-
llm = ChatGoogleGenerativeAI(model="gemini-
|
| 155 |
# 2. 定義 System Prompt (取代原本的 prompt_template)
|
| 156 |
system_prompt = "你是一個強大的影像生成及影像分析代理人。如果生成了圖片,請直接給出 URL。"
|
| 157 |
# 3. 直接建立包含 Executor 功能的 Agent
|
|
|
|
| 139 |
return "錯誤:找不到該圖片檔案。"
|
| 140 |
img_user = PIL.Image.open(image_path)
|
| 141 |
response = genai_client.models.generate_content(
|
| 142 |
+
model="gemini-3.1-flash-lite-preview", # "gemini-3.1-flash-lite-preview", "gemini-3-flash-preview"
|
| 143 |
contents=[img_user, user_text]
|
| 144 |
)
|
| 145 |
return response.text if response.text else "Gemini 沒答案!"
|
|
|
|
| 151 |
# ==========================
|
| 152 |
tools = [generate_and_upload_image, analyze_image_with_text]
|
| 153 |
# 1. 建立 LLM 模型
|
| 154 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash-lite", temperature=0.4)
|
| 155 |
# 2. 定義 System Prompt (取代原本的 prompt_template)
|
| 156 |
system_prompt = "你是一個強大的影像生成及影像分析代理人。如果生成了圖片,請直接給出 URL。"
|
| 157 |
# 3. 直接建立包含 Executor 功能的 Agent
|