Spaces:
Paused
Paused
Download apps/renderer/routes/materials.py from modventures/prevision: direct link, hf CLI and curl.
- Browser
- Download file 780 Bytes
-
https://huggingface.co/spaces/modventures/prevision/resolve/main/apps/renderer/routes/materials.py
- Command line
-
hf download hf://spaces/modventures/prevision/apps/renderer/routes/materials.py
-
curl -L -o materials.py https://huggingface.co/spaces/modventures/prevision/resolve/main/apps/renderer/routes/materials.py
780 Bytes
| """Material map preparation route.""" | |
| from fastapi import APIRouter, Depends, File, Form, UploadFile | |
| from errors import bad_request | |
| from services.access.policy import require_client | |
| from services.materials.cache import build_tile_material_package | |
| router = APIRouter(prefix="/materials", tags=["materials"], dependencies=[Depends(require_client)]) | |
| async def prepare_material_maps( | |
| file: UploadFile = File(...), | |
| base_roughness: float = Form(0.42), | |
| ): | |
| if file.content_type and not file.content_type.startswith("image/"): | |
| bad_request("Upload must be a tile image.") | |
| contents = await file.read() | |
| if not contents: | |
| bad_request("Upload must not be empty.") | |
| return build_tile_material_package(contents, base_roughness) | |