(
depth_input_images: List[str] = Body([], title='Input Images'),
options: Dict[str, object] = Body("options", title='Generation options'),
)
| 51 | # TODO: some potential inputs not supported (like custom depthmaps) |
| 52 | @app.post("/depth/generate") |
| 53 | async def process( |
| 54 | depth_input_images: List[str] = Body([], title='Input Images'), |
| 55 | options: Dict[str, object] = Body("options", title='Generation options'), |
| 56 | ): |
| 57 | # TODO: restrict mesh options |
| 58 | |
| 59 | if len(depth_input_images) == 0: |
| 60 | raise HTTPException(status_code=422, detail="No images supplied") |
| 61 | print(f"Processing {str(len(depth_input_images))} images trough the API") |
| 62 | |
| 63 | pil_images = [] |
| 64 | for input_image in depth_input_images: |
| 65 | pil_images.append(to_base64_PIL(input_image)) |
| 66 | outpath = backbone.get_outpath() |
| 67 | gen_obj = core_generation_funnel(outpath, pil_images, None, None, options) |
| 68 | |
| 69 | results_based = [] |
| 70 | for count, type, result in gen_obj: |
| 71 | if not isinstance(result, Image.Image): |
| 72 | continue |
| 73 | results_based += [encode_to_base64(result)] |
| 74 | |
| 75 | return {"images": results_based, "info": "Success"} |
| 76 | |
| 77 | @app.post("/depth/generate/video") |
| 78 | async def process_video( |
nothing calls this directly
no test coverage detected