Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -174,7 +174,7 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
|
|
| 174 |
img_user = PIL.Image.open(image_path)
|
| 175 |
|
| 176 |
response = genai_client.models.generate_content(
|
| 177 |
-
model="gemini-
|
| 178 |
contents=[img_user, user_text]
|
| 179 |
)
|
| 180 |
return response.text if response.text else "Gemini 沒答案!"
|
|
@@ -186,7 +186,7 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
|
|
| 186 |
# ==========================
|
| 187 |
tools = [generate_and_upload_image, analyze_image_with_text]
|
| 188 |
# 修正模型:gemini-3-flash-preview 目前在正式 API 中通常不可用
|
| 189 |
-
llm = ChatGoogleGenerativeAI(model="gemini-
|
| 190 |
|
| 191 |
prompt_template = ChatPromptTemplate.from_messages([
|
| 192 |
("system", "你是一個強大的助理。在使用工具之前,請務必先說明你的思考步驟。如果生成了圖片,請直接給出 URL。"),
|
|
|
|
| 174 |
img_user = PIL.Image.open(image_path)
|
| 175 |
|
| 176 |
response = genai_client.models.generate_content(
|
| 177 |
+
model="gemini-3-flash-preview",
|
| 178 |
contents=[img_user, user_text]
|
| 179 |
)
|
| 180 |
return response.text if response.text else "Gemini 沒答案!"
|
|
|
|
| 186 |
# ==========================
|
| 187 |
tools = [generate_and_upload_image, analyze_image_with_text]
|
| 188 |
# 修正模型:gemini-3-flash-preview 目前在正式 API 中通常不可用
|
| 189 |
+
llm = ChatGoogleGenerativeAI(model="gemini-3-flash-preview", temperature=0.4)
|
| 190 |
|
| 191 |
prompt_template = ChatPromptTemplate.from_messages([
|
| 192 |
("system", "你是一個強大的助理。在使用工具之前,請務必先說明你的思考步驟。如果生成了圖片,請直接給出 URL。"),
|