Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- src/app.py +6 -2
src/app.py
CHANGED
|
@@ -10,7 +10,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 10 |
from fastapi.responses import JSONResponse
|
| 11 |
from litrl.env.connect_four import Board
|
| 12 |
from loguru import logger
|
| 13 |
-
from fastapi.responses import StreamingResponse
|
| 14 |
from src.app_state import AppState
|
| 15 |
from src.typing import CpuConfig
|
| 16 |
from src.huggingface.huggingface_client import HuggingFaceClient
|
|
@@ -26,6 +26,10 @@ def stream_mp4(mp4_path: Path) -> StreamingResponse:
|
|
| 26 |
def create_app() -> FastAPI:
|
| 27 |
app = FastAPI()
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
@app.post("/", response_model=int)
|
| 30 |
def bot_action(
|
| 31 |
board: Board,
|
|
@@ -65,7 +69,7 @@ def create_app() -> FastAPI:
|
|
| 65 |
@app.get(path=f"/mp4")
|
| 66 |
def bot_action(
|
| 67 |
env_id: SingleAgentId,
|
| 68 |
-
) ->
|
| 69 |
env = make(id=env_id, render_mode="rgb_array")
|
| 70 |
env = RecordVideo(
|
| 71 |
env=env,
|
|
|
|
| 10 |
from fastapi.responses import JSONResponse
|
| 11 |
from litrl.env.connect_four import Board
|
| 12 |
from loguru import logger
|
| 13 |
+
from fastapi.responses import StreamingResponse, RedirectResponse
|
| 14 |
from src.app_state import AppState
|
| 15 |
from src.typing import CpuConfig
|
| 16 |
from src.huggingface.huggingface_client import HuggingFaceClient
|
|
|
|
| 26 |
def create_app() -> FastAPI:
|
| 27 |
app = FastAPI()
|
| 28 |
|
| 29 |
+
@app.get('/')
|
| 30 |
+
async def to_docs():
|
| 31 |
+
return RedirectResponse("/docs")
|
| 32 |
+
|
| 33 |
@app.post("/", response_model=int)
|
| 34 |
def bot_action(
|
| 35 |
board: Board,
|
|
|
|
| 69 |
@app.get(path=f"/mp4")
|
| 70 |
def bot_action(
|
| 71 |
env_id: SingleAgentId,
|
| 72 |
+
) -> StreamingResponse:
|
| 73 |
env = make(id=env_id, render_mode="rgb_array")
|
| 74 |
env = RecordVideo(
|
| 75 |
env=env,
|