Syeam Bin Abdullah commited on
fix: add app parameter to cord functions for Chutes compatibility
Browse files
chute.py
CHANGED
|
@@ -40,8 +40,7 @@ IMAGE_TAG = os.environ.get("IMAGE_TAG", f"{HF_REVISION[:8]}" if HF_REPO else "la
|
|
| 40 |
# =============================================================================
|
| 41 |
|
| 42 |
image = Image(CHUTES_USER, CHUTE_NAME, IMAGE_TAG, readme=f"Policy server for {HF_REPO or 'kinitro'}")
|
| 43 |
-
|
| 44 |
-
image.run_command("pip install --no-cache-dir numpy pydantic huggingface_hub")
|
| 45 |
|
| 46 |
if HF_REPO:
|
| 47 |
image.run_command(
|
|
@@ -138,7 +137,7 @@ def initialize(app):
|
|
| 138 |
|
| 139 |
|
| 140 |
@chute.cord(public_api_path="/health", public_api_method="GET")
|
| 141 |
-
async def health() -> HealthResponse:
|
| 142 |
"""Health check endpoint."""
|
| 143 |
import time
|
| 144 |
|
|
@@ -150,7 +149,7 @@ async def health() -> HealthResponse:
|
|
| 150 |
|
| 151 |
|
| 152 |
@chute.cord(public_api_path="/reset", public_api_method="POST")
|
| 153 |
-
async def reset(request: ResetRequest) -> ResetResponse:
|
| 154 |
"""Reset policy for a new episode."""
|
| 155 |
import uuid
|
| 156 |
|
|
@@ -166,7 +165,7 @@ async def reset(request: ResetRequest) -> ResetResponse:
|
|
| 166 |
|
| 167 |
|
| 168 |
@chute.cord(public_api_path="/act", public_api_method="POST")
|
| 169 |
-
async def act(request: ActRequest) -> ActResponse:
|
| 170 |
"""Get action for current observation."""
|
| 171 |
import numpy as np
|
| 172 |
|
|
|
|
| 40 |
# =============================================================================
|
| 41 |
|
| 42 |
image = Image(CHUTES_USER, CHUTE_NAME, IMAGE_TAG, readme=f"Policy server for {HF_REPO or 'kinitro'}")
|
| 43 |
+
image.run_command("pip install --no-cache-dir torch numpy pydantic huggingface_hub")
|
|
|
|
| 44 |
|
| 45 |
if HF_REPO:
|
| 46 |
image.run_command(
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
@chute.cord(public_api_path="/health", public_api_method="GET")
|
| 140 |
+
async def health(app=None) -> HealthResponse:
|
| 141 |
"""Health check endpoint."""
|
| 142 |
import time
|
| 143 |
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
@chute.cord(public_api_path="/reset", public_api_method="POST")
|
| 152 |
+
async def reset(request: ResetRequest, app=None) -> ResetResponse:
|
| 153 |
"""Reset policy for a new episode."""
|
| 154 |
import uuid
|
| 155 |
|
|
|
|
| 165 |
|
| 166 |
|
| 167 |
@chute.cord(public_api_path="/act", public_api_method="POST")
|
| 168 |
+
async def act(request: ActRequest, app=None) -> ActResponse:
|
| 169 |
"""Get action for current observation."""
|
| 170 |
import numpy as np
|
| 171 |
|