Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -147,9 +147,11 @@ def analyze_image_with_text(image_path: str, user_text: str) -> str:
|
|
| 147 |
|
| 148 |
img_user = PIL.Image.open(image_path)
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
-
response = chat_model.send_message([img_usr, user_text])
|
| 153 |
if (response.text != None):
|
| 154 |
out = response.text
|
| 155 |
else:
|
|
@@ -174,8 +176,8 @@ llm = ChatGoogleGenerativeAI(google_api_key=google_api, model="gemini-2.0-flash"
|
|
| 174 |
# 建立提示模板
|
| 175 |
prompt_template = ChatPromptTemplate.from_messages([
|
| 176 |
("system", "你是一個強大的助理,可以根據用戶的請求使用提供的工具。"),
|
| 177 |
-
("user", "{
|
| 178 |
-
("placeholder", {
|
| 179 |
])
|
| 180 |
|
| 181 |
# 建立代理人
|
|
|
|
| 147 |
|
| 148 |
img_user = PIL.Image.open(image_path)
|
| 149 |
|
| 150 |
+
response = genai_client.models.generate_content(
|
| 151 |
+
model="gemini-2.0-flash-exp",
|
| 152 |
+
contents=[img_user, user_text]
|
| 153 |
+
)
|
| 154 |
|
|
|
|
| 155 |
if (response.text != None):
|
| 156 |
out = response.text
|
| 157 |
else:
|
|
|
|
| 176 |
# 建立提示模板
|
| 177 |
prompt_template = ChatPromptTemplate.from_messages([
|
| 178 |
("system", "你是一個強大的助理,可以根據用戶的請求使用提供的工具。"),
|
| 179 |
+
("user", "{input}"),
|
| 180 |
+
("placeholder", {"agent_scratchpad"}),
|
| 181 |
])
|
| 182 |
|
| 183 |
# 建立代理人
|