Chrisyichuan commited on
Commit
1300289
·
1 Parent(s): f1d54eb
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -255,15 +255,7 @@ if start_button:
255
  )
256
 
257
  # Force guess on last step or get AI decision
258
- if step_num == steps_per_sample:
259
- action = "GUESS"
260
- st.warning("Max steps reached. Forcing GUESS.")
261
- # Create a forced decision for consistency
262
- decision = {
263
- "reasoning": "Maximum steps reached, forcing final guess with fallback coordinates.",
264
- "action_details": {"action": "GUESS", "lat": 0.0, "lon": 0.0}
265
- }
266
- else:
267
  # Use the bot's agent step execution
268
  remaining_steps = steps_per_sample - step
269
  decision = bot.execute_agent_step(
@@ -273,18 +265,18 @@ if start_button:
273
  if decision is None:
274
  raise ValueError("Failed to get AI decision")
275
 
276
- action = decision["action_details"]["action"]
277
 
278
- # Show AI decision
279
- st.write("**AI Reasoning:**")
280
- st.info(decision.get("reasoning", "N/A"))
281
 
282
- st.write("**AI Action:**")
283
- st.success(f"`{action}`")
284
 
285
- # Show raw response for debugging
286
- with st.expander("Decision Details"):
287
- st.json(decision)
288
 
289
  # Add step to history using the bot's method
290
  bot.add_step_to_history(history, current_screenshot_b64, decision)
 
255
  )
256
 
257
  # Force guess on last step or get AI decision
258
+ if action != "GUESS":
 
 
 
 
 
 
 
 
259
  # Use the bot's agent step execution
260
  remaining_steps = steps_per_sample - step
261
  decision = bot.execute_agent_step(
 
265
  if decision is None:
266
  raise ValueError("Failed to get AI decision")
267
 
268
+ action = decision["action_details"]["action"]
269
 
270
+ # Show AI decision
271
+ st.write("**AI Reasoning:**")
272
+ st.info(decision.get("reasoning", "N/A"))
273
 
274
+ st.write("**AI Action:**")
275
+ st.success(f"`{action}`")
276
 
277
+ # Show raw response for debugging
278
+ with st.expander("Decision Details"):
279
+ st.json(decision)
280
 
281
  # Add step to history using the bot's method
282
  bot.add_step_to_history(history, current_screenshot_b64, decision)