Spaces:
Running
Running
Commit Β·
2823866
1
Parent(s): 4db620f
cot
Browse files
app.py
CHANGED
|
@@ -65,43 +65,11 @@ sample_agents = sorted(sp["agent_id"].unique().tolist())
|
|
| 65 |
print(f"Ready. {len(sample_agents)} agents loaded.")
|
| 66 |
|
| 67 |
|
| 68 |
-
# ββ Mock CoT (fallback when agent not in JSON) ββββββββββββββββββββββββββββββββ
|
| 69 |
-
|
| 70 |
-
MOCK_S1 = """LOCATION INVENTORY:
|
| 71 |
-
- Top venues: residence (36 visits), Clinton Mobile Estates (9 visits), 7-Eleven (8 visits)
|
| 72 |
-
- Price level: budget (7-Eleven, car wash) and mid-range (Euro Caffe, Pepper Shaker Cafe)
|
| 73 |
-
- Neighborhood: residential and commercial urban mix
|
| 74 |
-
|
| 75 |
-
TEMPORAL PATTERNS:
|
| 76 |
-
- Active hours: 09:00-23:00
|
| 77 |
-
- Weekday/Weekend: 66% weekday, 34% weekend
|
| 78 |
-
- Routine: consistent morning start times
|
| 79 |
-
|
| 80 |
-
SEQUENCE:
|
| 81 |
-
- Typical chain: Home to Exercise/Work to Home
|
| 82 |
-
- Notable pattern: weekend religious visits every Sunday morning"""
|
| 83 |
-
|
| 84 |
-
MOCK_S2 = """SCHEDULE: Fixed weekday routine with flexible afternoon activities
|
| 85 |
-
ECONOMIC: Budget-conscious with occasional mid-range dining
|
| 86 |
-
SOCIAL: Community-engaged through regular religious attendance
|
| 87 |
-
LIFESTYLE: Urban working-class with active recreational habits
|
| 88 |
-
STABILITY: Highly consistent 4-week pattern with minimal deviation"""
|
| 89 |
-
|
| 90 |
-
MOCK_S3 = """INCOME_PREDICTION: Middle ($35k-$75k)
|
| 91 |
-
INCOME_CONFIDENCE: 4
|
| 92 |
-
INCOME_REASONING: Frequent budget venue visits (7-Eleven, self-service car wash) signal cost awareness, while occasional mid-range dining and stable employment-like patterns at Clinton Mobile Estates suggest a steady middle income. No luxury venue signals detected.
|
| 93 |
-
ALTERNATIVES: Low ($15k-$35k) | Upper-Middle ($75k-$125k)"""
|
| 94 |
-
|
| 95 |
-
|
| 96 |
def get_cot(agent_id):
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
s2 = result.get("step2_response", MOCK_S2)
|
| 102 |
-
s3 = result.get("step3_response", MOCK_S3)
|
| 103 |
-
else:
|
| 104 |
-
s1, s2, s3 = MOCK_S1, MOCK_S2, MOCK_S3
|
| 105 |
return s1, s2, s3
|
| 106 |
|
| 107 |
|
|
@@ -591,7 +559,7 @@ def on_select_reset(agent_id):
|
|
| 591 |
map_html = build_map(agent_sp)
|
| 592 |
demo_text = build_demo_text(agent_demo)
|
| 593 |
cot_entry = cot_by_agent.get(agent_id_int, {})
|
| 594 |
-
summary =
|
| 595 |
raw_full = cot_entry.get("weekly_checkin") or build_weekly_checkin(agent_sp)
|
| 596 |
sep = "\n\n--- "
|
| 597 |
parts = raw_full.split(sep)
|
|
|
|
| 65 |
print(f"Ready. {len(sample_agents)} agents loaded.")
|
| 66 |
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
def get_cot(agent_id):
|
| 69 |
+
result = cot_by_agent.get(int(agent_id), {})
|
| 70 |
+
s1 = result.get("step1_response", "")
|
| 71 |
+
s2 = result.get("step2_response", "")
|
| 72 |
+
s3 = result.get("step3_response", "")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
return s1, s2, s3
|
| 74 |
|
| 75 |
|
|
|
|
| 559 |
map_html = build_map(agent_sp)
|
| 560 |
demo_text = build_demo_text(agent_demo)
|
| 561 |
cot_entry = cot_by_agent.get(agent_id_int, {})
|
| 562 |
+
summary = build_mobility_summary(agent_sp)
|
| 563 |
raw_full = cot_entry.get("weekly_checkin") or build_weekly_checkin(agent_sp)
|
| 564 |
sep = "\n\n--- "
|
| 565 |
parts = raw_full.split(sep)
|