kdemon1011 commited on
Commit
f0dcfd3
·
verified ·
1 Parent(s): cf97313

Upload server/app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. server/app.py +56 -0
server/app.py CHANGED
@@ -19,6 +19,62 @@ from openenv.core.env_server.http_server import create_app
19
 
20
  load_dotenv(os.path.join(os.path.dirname(__file__), "..", ".env"))
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  try:
23
  from visual_memory.models import VisualMemoryAction, VisualMemoryObservation
24
  from visual_memory.server.memory_environment import MemoryEnvironment
 
19
 
20
  load_dotenv(os.path.join(os.path.dirname(__file__), "..", ".env"))
21
 
22
+ # Override the generic Quick Start with gym-specific content
23
+ import openenv.core.env_server.web_interface as _wi # noqa: E402
24
+
25
+ _wi.DEFAULT_QUICK_START_MARKDOWN = """
26
+ ### How to use this environment
27
+
28
+ Use the **Playground** (right panel) to interact. Enter a **Tool Name** and **Arguments Json**, then click **Step**.
29
+
30
+ #### 1. Start a game
31
+
32
+ | Step | Tool Name | Arguments Json |
33
+ |------|-----------|---------------|
34
+ | Reset | Click **Reset** | — |
35
+ | List scenarios | `list_scenarios` | `{}` |
36
+ | Load a game | `load_scenario` | `{"scenario_id": "directional_trap_8x8"}` |
37
+
38
+ #### 2. Explore the board
39
+
40
+ | Tool Name | Arguments Json | What it does |
41
+ |-----------|---------------|--------------|
42
+ | `get_board_view` | `{}` | See the board (SVG) |
43
+ | `get_status` | `{}` | Score, flags, progress |
44
+ | `reveal_cell` | `{"row": 0, "col": 0}` | Uncover a cell (costs 1 step) |
45
+ | `inspect_region` | `{"row": 3, "col": 3, "radius": 1}` | Peek without revealing |
46
+ | `recall_log` | `{}` | Review all signals found |
47
+
48
+ #### 3. Flag hazards & submit
49
+
50
+ | Tool Name | Arguments Json | What it does |
51
+ |-----------|---------------|--------------|
52
+ | `flag_cell` | `{"row": 1, "col": 1}` | Mark as hazardous |
53
+ | `unflag_cell` | `{"row": 1, "col": 1}` | Remove flag |
54
+ | `submit_solution` | `{"flagged_positions": "[[0,1],[2,3]]"}` | Submit answer (ends game) |
55
+
56
+ #### Available scenarios
57
+
58
+ `ambiguous_cluster_10x10` · `directional_trap_8x8` · `partial_intel_9x9` · `cascading_deduction_11x11` · `safe_zone_identification_9x9` · `flash_fade_minefield_7x7` · `delayed_recall_keys_8x8` · `fog_labyrinth_10x10` · `fog_key_hunt_8x8` · `decoy_minefield_8x10`
59
+
60
+ #### Connect from Python
61
+
62
+ ```python
63
+ from visual_memory import VisualMemoryAction, VisualMemoryEnv
64
+
65
+ with VisualMemoryEnv.from_env("<SPACE_ID>") as env:
66
+ obs = env.reset()
67
+ obs = await env.step(VisualMemoryAction(
68
+ tool_name="load_scenario",
69
+ arguments_json='{"scenario_id": "directional_trap_8x8"}'
70
+ ))
71
+ ```
72
+
73
+ Or connect directly: `VisualMemoryEnv(base_url="http://localhost:8000")`
74
+
75
+ For more information, see the [OpenEnv documentation](https://meta-pytorch.org/OpenEnv/).
76
+ """
77
+
78
  try:
79
  from visual_memory.models import VisualMemoryAction, VisualMemoryObservation
80
  from visual_memory.server.memory_environment import MemoryEnvironment