MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / process

Function process

scripts/depthmap_api.py:53–75  ·  view source on GitHub ↗
(
        depth_input_images: List[str] = Body([], title='Input Images'),
        options: Dict[str, object] = Body("options", title='Generation options'),
    )

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 4

core_generation_funnelFunction · 0.90
to_base64_PILFunction · 0.85
encode_to_base64Function · 0.85
appendMethod · 0.80

Tested by

no test coverage detected