Param20h commited on
Commit
733e095
·
verified ·
1 Parent(s): 2541228

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. server/app.py +6 -0
server/app.py CHANGED
@@ -111,6 +111,7 @@ def web_health() -> Dict[str, str]:
111
 
112
 
113
  @app.post("/reset", response_model=Observation, summary="Start / restart an episode")
 
114
  def reset(req: ResetRequest) -> Observation:
115
  """Reset the environment for a given task_id (1=easy, 2=medium, 3=hard)."""
116
  try:
@@ -121,6 +122,7 @@ def reset(req: ResetRequest) -> Observation:
121
 
122
 
123
  @app.post("/step", response_model=StepResponse, summary="Submit an action")
 
124
  def step(action: Action) -> StepResponse:
125
  """Advance the environment by submitting an Action."""
126
  try:
@@ -131,12 +133,14 @@ def step(action: Action) -> StepResponse:
131
 
132
 
133
  @app.get("/state", summary="Return current internal state")
 
134
  def state() -> Dict[str, Any]:
135
  """Return the current internal state of the environment."""
136
  return _env.state()
137
 
138
 
139
  @app.get("/tasks", response_model=list[TaskInfo], summary="List tasks + action schema")
 
140
  def list_tasks() -> list[TaskInfo]:
141
  """Return all tasks with descriptions and the action schema."""
142
  action_schema = Action.model_json_schema()
@@ -153,6 +157,7 @@ def list_tasks() -> list[TaskInfo]:
153
 
154
 
155
  @app.get("/grader", response_model=GraderResponse, summary="Grader score for last episode")
 
156
  def grader() -> GraderResponse:
157
  """Return the grader score after the current/last episode."""
158
  s = _env.state()
@@ -167,6 +172,7 @@ def grader() -> GraderResponse:
167
 
168
 
169
  @app.post("/baseline", response_model=BaselineResponse, summary="Run baseline inference on all tasks")
 
170
  def baseline() -> BaselineResponse:
171
  """
172
  Trigger the baseline inference script (inference.py) and return scores.
 
111
 
112
 
113
  @app.post("/reset", response_model=Observation, summary="Start / restart an episode")
114
+ @app.post("/web/reset", response_model=Observation, include_in_schema=False)
115
  def reset(req: ResetRequest) -> Observation:
116
  """Reset the environment for a given task_id (1=easy, 2=medium, 3=hard)."""
117
  try:
 
122
 
123
 
124
  @app.post("/step", response_model=StepResponse, summary="Submit an action")
125
+ @app.post("/web/step", response_model=StepResponse, include_in_schema=False)
126
  def step(action: Action) -> StepResponse:
127
  """Advance the environment by submitting an Action."""
128
  try:
 
133
 
134
 
135
  @app.get("/state", summary="Return current internal state")
136
+ @app.get("/web/state", include_in_schema=False)
137
  def state() -> Dict[str, Any]:
138
  """Return the current internal state of the environment."""
139
  return _env.state()
140
 
141
 
142
  @app.get("/tasks", response_model=list[TaskInfo], summary="List tasks + action schema")
143
+ @app.get("/web/tasks", response_model=list[TaskInfo], include_in_schema=False)
144
  def list_tasks() -> list[TaskInfo]:
145
  """Return all tasks with descriptions and the action schema."""
146
  action_schema = Action.model_json_schema()
 
157
 
158
 
159
  @app.get("/grader", response_model=GraderResponse, summary="Grader score for last episode")
160
+ @app.get("/web/grader", response_model=GraderResponse, include_in_schema=False)
161
  def grader() -> GraderResponse:
162
  """Return the grader score after the current/last episode."""
163
  s = _env.state()
 
172
 
173
 
174
  @app.post("/baseline", response_model=BaselineResponse, summary="Run baseline inference on all tasks")
175
+ @app.post("/web/baseline", response_model=BaselineResponse, include_in_schema=False)
176
  def baseline() -> BaselineResponse:
177
  """
178
  Trigger the baseline inference script (inference.py) and return scores.