Spaces:
Sleeping
Sleeping
Andy Lee
commited on
Commit
·
5e47334
1
Parent(s):
1c04950
fix: qwen 2.5 not supported
Browse files
app.py
CHANGED
|
@@ -163,43 +163,44 @@ if start_button:
|
|
| 163 |
key=f"history_{i}_{step}",
|
| 164 |
)
|
| 165 |
|
| 166 |
-
#
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
message = bot._create_message_with_history(
|
| 169 |
prompt, [h["image_b64"] for h in history]
|
| 170 |
)
|
| 171 |
response = bot.model.invoke(message)
|
| 172 |
decision = bot._parse_agent_response(response)
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
action = decision.get("action_details", {}).get("action")
|
| 181 |
-
history[-1]["action"] = action
|
| 182 |
-
|
| 183 |
-
# Show AI decision
|
| 184 |
-
st.write("**AI Reasoning:**")
|
| 185 |
-
st.info(decision.get("reasoning", "N/A"))
|
| 186 |
|
| 187 |
-
|
| 188 |
-
|
|
|
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
st.text(response.content)
|
| 193 |
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
action = "GUESS"
|
| 198 |
|
| 199 |
# Execute action
|
| 200 |
if action == "GUESS":
|
| 201 |
-
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
if lat is not None and lon is not None:
|
| 204 |
final_guess = (lat, lon)
|
| 205 |
st.success(f"Final Guess: {lat:.4f}, {lon:.4f}")
|
|
@@ -213,6 +214,8 @@ if start_button:
|
|
| 213 |
elif action == "PAN_RIGHT":
|
| 214 |
bot.controller.pan_view("right")
|
| 215 |
|
|
|
|
|
|
|
| 216 |
time.sleep(1)
|
| 217 |
|
| 218 |
# Sample Results
|
|
|
|
| 163 |
key=f"history_{i}_{step}",
|
| 164 |
)
|
| 165 |
|
| 166 |
+
# Force guess on last step or get AI decision
|
| 167 |
+
if step_num == steps_per_sample:
|
| 168 |
+
action = "GUESS"
|
| 169 |
+
st.warning("Max steps reached. Forcing GUESS.")
|
| 170 |
+
else:
|
| 171 |
+
# Get AI response
|
| 172 |
message = bot._create_message_with_history(
|
| 173 |
prompt, [h["image_b64"] for h in history]
|
| 174 |
)
|
| 175 |
response = bot.model.invoke(message)
|
| 176 |
decision = bot._parse_agent_response(response)
|
| 177 |
|
| 178 |
+
action = decision.get("action_details", {}).get(
|
| 179 |
+
"action"
|
| 180 |
+
)
|
| 181 |
+
history[-1]["action"] = action
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
+
# Show AI decision
|
| 184 |
+
st.write("**AI Reasoning:**")
|
| 185 |
+
st.info(decision.get("reasoning", "N/A"))
|
| 186 |
|
| 187 |
+
st.write("**AI Action:**")
|
| 188 |
+
st.success(f"`{action}`")
|
|
|
|
| 189 |
|
| 190 |
+
# Show raw response
|
| 191 |
+
with st.expander("Raw AI Response"):
|
| 192 |
+
st.text(response.content)
|
|
|
|
| 193 |
|
| 194 |
# Execute action
|
| 195 |
if action == "GUESS":
|
| 196 |
+
if step_num == steps_per_sample:
|
| 197 |
+
# Forced guess - use fallback coordinates
|
| 198 |
+
lat, lon = 0.0, 0.0
|
| 199 |
+
st.error("Forced guess with fallback coordinates")
|
| 200 |
+
else:
|
| 201 |
+
lat = decision.get("action_details", {}).get("lat")
|
| 202 |
+
lon = decision.get("action_details", {}).get("lon")
|
| 203 |
+
|
| 204 |
if lat is not None and lon is not None:
|
| 205 |
final_guess = (lat, lon)
|
| 206 |
st.success(f"Final Guess: {lat:.4f}, {lon:.4f}")
|
|
|
|
| 214 |
elif action == "PAN_RIGHT":
|
| 215 |
bot.controller.pan_view("right")
|
| 216 |
|
| 217 |
+
# Auto scroll to bottom
|
| 218 |
+
st.empty() # Force refresh to show latest content
|
| 219 |
time.sleep(1)
|
| 220 |
|
| 221 |
# Sample Results
|
config.py
CHANGED
|
@@ -48,15 +48,15 @@ MODELS_CONFIG = {
|
|
| 48 |
"model_name": "gemini-1.5-pro-latest",
|
| 49 |
"description": "Google Gemini 1.5 Pro",
|
| 50 |
},
|
| 51 |
-
"qwen2
|
| 52 |
"class": "HuggingFaceChat",
|
| 53 |
-
"model_name": "Qwen/Qwen2
|
| 54 |
-
"description": "Qwen2
|
| 55 |
},
|
| 56 |
-
"qwen2
|
| 57 |
"class": "HuggingFaceChat",
|
| 58 |
-
"model_name": "Qwen/Qwen2
|
| 59 |
-
"description": "Qwen2
|
| 60 |
},
|
| 61 |
}
|
| 62 |
|
|
|
|
| 48 |
"model_name": "gemini-1.5-pro-latest",
|
| 49 |
"description": "Google Gemini 1.5 Pro",
|
| 50 |
},
|
| 51 |
+
"qwen2-vl-7b": {
|
| 52 |
"class": "HuggingFaceChat",
|
| 53 |
+
"model_name": "Qwen/Qwen2-VL-7B-Instruct",
|
| 54 |
+
"description": "Qwen2-VL 7B (older but API supported)",
|
| 55 |
},
|
| 56 |
+
"qwen2-vl-2b": {
|
| 57 |
"class": "HuggingFaceChat",
|
| 58 |
+
"model_name": "Qwen/Qwen2-VL-2B-Instruct",
|
| 59 |
+
"description": "Qwen2-VL 2B (faster, API supported)",
|
| 60 |
},
|
| 61 |
}
|
| 62 |
|