comfy-ts 2.22.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ServeApp-DuxYdaZZ.js → ServeApp-fsHtW5zG.js} +51 -17
- package/dist/ServeApp-fsHtW5zG.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{exampleAssets-1NHndnNB.js → exampleAssets-DZynSkZm.js} +405 -39
- package/dist/exampleAssets-DZynSkZm.js.map +1 -0
- package/dist/{findDefinedWorkflow-CRsBTTJK.js → findDefinedWorkflow-qyqFea7q.js} +2 -2
- package/dist/{findDefinedWorkflow-CRsBTTJK.js.map → findDefinedWorkflow-qyqFea7q.js.map} +1 -1
- package/dist/index.cjs +428 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -1
- package/dist/index.d.ts +147 -1
- package/dist/index.js +428 -47
- package/dist/index.js.map +1 -1
- package/dist/{run-run-Y5ZI48vV.js → run-run-Cn2JzKlE.js} +5 -5
- package/dist/{run-run-Y5ZI48vV.js.map → run-run-Cn2JzKlE.js.map} +1 -1
- package/dist/{run-serve-CICU_wTL.js → run-serve-BhGegaCI.js} +4 -4
- package/dist/{run-serve-CICU_wTL.js.map → run-serve-BhGegaCI.js.map} +1 -1
- package/dist/{run-tui-CViJXsHL.js → run-tui-CrM4ijkH.js} +4 -4
- package/dist/{run-tui-CViJXsHL.js.map → run-tui-CrM4ijkH.js.map} +1 -1
- package/dist/{schemaDrift-CzjaIwZX.js → schemaDrift-BGYJZGMD.js} +18 -3
- package/dist/{schemaDrift-CzjaIwZX.js.map → schemaDrift-BGYJZGMD.js.map} +1 -1
- package/dist/serve-web.js +46 -43
- package/dist/web.d.ts +147 -1
- package/dist/web.js +428 -47
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/comfy-cloud/sdk.d.ts +102 -1
- package/examples/depth-explorer/models.ts +6 -56
- package/examples/depth-explorer/serve.ts +12 -133
- package/examples/depth-explorer/web/App.tsx +20 -91
- package/examples/depth-explorer/web/index.html +1 -0
- package/examples/depth-explorer/web/state.ts +26 -109
- package/examples/depth-explorer/web/styles.css +1 -286
- package/examples/explorer-kit/catalog.ts +80 -0
- package/examples/explorer-kit/server.ts +167 -0
- package/examples/explorer-kit/web/base.css +289 -0
- package/examples/explorer-kit/web/runs.ts +160 -0
- package/examples/explorer-kit/web/ui.tsx +125 -0
- package/examples/rvion/17-relight.cflow.ts +2 -1
- package/examples/rvion/18-world.cflow.ts +101 -0
- package/examples/rvion/19-flythrough.cflow.ts +312 -0
- package/examples/rvion/20-grow-splat.cflow.ts +88 -0
- package/examples/rvion/21-photo-to-model.cflow.ts +191 -0
- package/examples/rvion/flythroughChain.ts +171 -0
- package/examples/rvion/flythroughColmap.ts +157 -0
- package/examples/rvion/flythroughFuse.ts +199 -0
- package/examples/rvion/flythroughGuide.ts +300 -0
- package/examples/rvion/flythroughPalette.ts +310 -0
- package/examples/rvion/flythroughPath.ts +177 -0
- package/examples/rvion/flythroughSplat.ts +73 -0
- package/examples/rvion/grow-splat/align.ts +114 -0
- package/examples/rvion/grow-splat/grow.ts +198 -0
- package/examples/rvion/grow-splat/ply.ts +166 -0
- package/examples/rvion/grow-splat/raster.ts +207 -0
- package/examples/rvion/grow-splat/sharp.ts +45 -0
- package/examples/rvion/splatDataset.ts +80 -0
- package/examples/rvion/splatEval.ts +380 -0
- package/examples/upscale-explorer/models.ts +341 -0
- package/examples/upscale-explorer/serve.ts +19 -0
- package/examples/upscale-explorer/web/App.tsx +250 -0
- package/examples/upscale-explorer/web/compare.tsx +285 -0
- package/examples/upscale-explorer/web/index.html +15 -0
- package/examples/upscale-explorer/web/main.tsx +12 -0
- package/examples/upscale-explorer/web/state.ts +279 -0
- package/examples/upscale-explorer/web/styles.css +241 -0
- package/examples/upscale-explorer/web/tsconfig.json +16 -0
- package/examples/upscale-explorer/web/viewport.tsx +130 -0
- package/examples/world-explorer/serve.ts +171 -0
- package/examples/world-explorer/web/index.html +14 -0
- package/examples/world-explorer/web/main.tsx +200 -0
- package/examples/world-explorer/web/state.ts +212 -0
- package/examples/world-explorer/web/styles.css +131 -0
- package/examples/world-explorer/web/thumb.ts +21 -0
- package/examples/world-explorer/web/tsconfig.json +11 -0
- package/examples/world-explorer/world-state.ts +40 -0
- package/package.json +7 -8
- package/src/cli/serve/ServeApp.ts +27 -2
- package/src/cli/serve/resultHistory.ts +22 -4
- package/src/cli/serve/thumbs.ts +19 -8
- package/src/cli/serve/web/api.ts +4 -0
- package/src/cli/serve/web/components/Gallery.tsx +24 -1
- package/src/cli/serve/web/styles.ts +3 -0
- package/src/coreExports.ts +6 -0
- package/src/graph/ComfyNode.ts +12 -2
- package/src/host/ComfyHost.ts +159 -2
- package/src/host/ResilientWebsocket.ts +10 -0
- package/src/manager/script-update-manager.bun.ts +0 -7
- package/src/runner/ComfyExecution.ts +185 -23
- package/src/runner/ComfyWorkflow.ts +22 -0
- package/src/runner/ComfyWsApi.ts +3 -1
- package/src/runner/comfyOrgApiKey.ts +44 -0
- package/src/runner/historyReplay.ts +53 -0
- package/src/runner/outputs3d.ts +18 -0
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +2 -0
- package/src/sdk-generator/comfyui-sdk-codegen.ts +7 -2
- package/src/state.ts +2 -0
- package/src/vars/DefinedWorkflow.ts +1 -0
- package/dist/ServeApp-DuxYdaZZ.js.map +0 -1
- package/dist/exampleAssets-1NHndnNB.js.map +0 -1
package/examples/README.md
CHANGED
|
@@ -20,6 +20,7 @@ Every `*.cflow.ts` file here is a runnable workflow module. Run it directly with
|
|
|
20
20
|
- `web/`: the browser entry `comfy-ts/web` in a runnable page (`bun examples/web/serve.ts`).
|
|
21
21
|
- `rvion/17-relight.cflow.ts`: relight a photo in the web panel. It runs one depth model and one normal model (a choice each) and, behind two toggles, Marigold material maps (albedo, roughness, metalness, reflections). Every map is tagged, and the module names the panel's `relight` widget, which draws the photo lit by a point light you drag over it: left/right, up/down, the wheel for nearer/farther, with shadows from the depth map and drifting light motes. Needs the ControlNet preprocessors pack and, for materials, [ComfyUI-Marigold](https://github.com/kijai/ComfyUI-Marigold).
|
|
22
22
|
- `depth-explorer/`: a small web app that runs every depth, normal and material estimator your host has on one image and compares them: a grid, a wipe slider against the source or another model, a 3D relief of each depth map, and the relight widget fed with the best maps of the grid (`bun examples/depth-explorer/serve.ts [--samples <dir>]`, then http://127.0.0.1:8292). Depth Anything 3, MoGe-2, Marigold v2, Lotus, Depth Anything V2, Metric3D v2, DSINE, Marigold IID and the ControlNet preprocessors; a model your host lacks shows the weight files it needs, with their download links. One ComfyUI graph per model lives in `depth-explorer/models.ts`.
|
|
23
|
+
- `upscale-explorer/`: the same kind of app for upscalers (`bun examples/upscale-explorer/serve.ts [--samples <dir>]`, then http://127.0.0.1:8294). Every result comes out at the same size (×2 or ×4 the source), so you can judge them pixel for pixel: a loupe shows every result on the same crop at 100 %, and a pair view compares two of them side by side, with a curtain, as an onion skin, one over the other on hover, or as the pixels that changed. The wheel zooms at the pointer and every picture follows. UltraSharp V2, IllustrationJaNai V3, Nomos2, AnimeSharp V4, SeedVR2 (3B and 7B sharp, on core ComfyUI nodes) and the ESRGAN classics, each against plain Lanczos. Both apps share `explorer-kit/`.
|
|
23
24
|
|
|
24
25
|
## Cloud API key
|
|
25
26
|
|
|
@@ -126589,54 +126589,112 @@ declare global {
|
|
|
126589
126589
|
| ((
|
|
126590
126590
|
x: Producer['MESH,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D_STL,FILE_3D_USDZ,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT,FILE_3D_SPLAT_ANY,FILE_3D_POINT_CLOUD_ANY,FILE_3D'],
|
|
126591
126591
|
) => Accepts['MESH,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D_STL,FILE_3D_USDZ,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT,FILE_3D_SPLAT_ANY,FILE_3D_POINT_CLOUD_ANY,FILE_3D'])
|
|
126592
|
+
| Accepts['MESH']
|
|
126593
|
+
| Accepts['FILE_3D_GLB']
|
|
126594
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126595
|
+
| Accepts['FILE_3D_OBJ']
|
|
126596
|
+
| Accepts['FILE_3D_FBX']
|
|
126597
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126598
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126599
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126600
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126601
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126602
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126603
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126604
|
+
| Accepts['FILE_3D_POINT_CLOUD_ANY']
|
|
126605
|
+
| Accepts['FILE_3D']
|
|
126592
126606
|
'STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D':
|
|
126593
126607
|
| ComfyNodeOutput<'STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'>
|
|
126594
126608
|
| HasSingle['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D']
|
|
126595
126609
|
| ((
|
|
126596
126610
|
x: Producer['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'],
|
|
126597
126611
|
) => Accepts['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'])
|
|
126612
|
+
| Accepts['STRING']
|
|
126613
|
+
| Accepts['FILE_3D_GLB']
|
|
126614
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126615
|
+
| Accepts['FILE_3D_FBX']
|
|
126616
|
+
| Accepts['FILE_3D_OBJ']
|
|
126617
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126618
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126619
|
+
| Accepts['FILE_3D']
|
|
126598
126620
|
'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D':
|
|
126599
126621
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'>
|
|
126600
126622
|
| HasSingle['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D']
|
|
126601
126623
|
| ((
|
|
126602
126624
|
x: Producer['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'],
|
|
126603
126625
|
) => Accepts['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'])
|
|
126626
|
+
| Accepts['FILE_3D_GLB']
|
|
126627
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126628
|
+
| Accepts['FILE_3D_FBX']
|
|
126629
|
+
| Accepts['FILE_3D_OBJ']
|
|
126630
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126631
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126632
|
+
| Accepts['FILE_3D']
|
|
126604
126633
|
'FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ':
|
|
126605
126634
|
| ComfyNodeOutput<'FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'>
|
|
126606
126635
|
| HasSingle['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ']
|
|
126607
126636
|
| ((
|
|
126608
126637
|
x: Producer['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'],
|
|
126609
126638
|
) => Accepts['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'])
|
|
126639
|
+
| Accepts['FILE_3D']
|
|
126640
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126641
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126642
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126643
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126644
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126610
126645
|
'FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT':
|
|
126611
126646
|
| ComfyNodeOutput<'FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'>
|
|
126612
126647
|
| HasSingle['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT']
|
|
126613
126648
|
| ((
|
|
126614
126649
|
x: Producer['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'],
|
|
126615
126650
|
) => Accepts['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'])
|
|
126651
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126652
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126653
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126654
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126655
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126616
126656
|
'MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID':
|
|
126617
126657
|
| ComfyNodeOutput<'MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'>
|
|
126618
126658
|
| HasSingle['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID']
|
|
126619
126659
|
| ((
|
|
126620
126660
|
x: Producer['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'],
|
|
126621
126661
|
) => Accepts['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'])
|
|
126662
|
+
| Accepts['MODEL_TASK_ID']
|
|
126663
|
+
| Accepts['RIG_TASK_ID']
|
|
126664
|
+
| Accepts['RETARGET_TASK_ID']
|
|
126665
|
+
| Accepts['SEGMENT_TASK_ID']
|
|
126622
126666
|
'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D':
|
|
126623
126667
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'>
|
|
126624
126668
|
| HasSingle['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D']
|
|
126625
126669
|
| ((
|
|
126626
126670
|
x: Producer['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'],
|
|
126627
126671
|
) => Accepts['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'])
|
|
126672
|
+
| Accepts['FILE_3D_GLB']
|
|
126673
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126674
|
+
| Accepts['FILE_3D_OBJ']
|
|
126675
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126676
|
+
| Accepts['FILE_3D']
|
|
126628
126677
|
'FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D':
|
|
126629
126678
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'>
|
|
126630
126679
|
| HasSingle['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D']
|
|
126631
126680
|
| ((
|
|
126632
126681
|
x: Producer['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'],
|
|
126633
126682
|
) => Accepts['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'])
|
|
126683
|
+
| Accepts['FILE_3D_GLB']
|
|
126684
|
+
| Accepts['FILE_3D_FBX']
|
|
126685
|
+
| Accepts['FILE_3D_OBJ']
|
|
126686
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126687
|
+
| Accepts['FILE_3D']
|
|
126634
126688
|
'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D':
|
|
126635
126689
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'>
|
|
126636
126690
|
| HasSingle['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D']
|
|
126637
126691
|
| ((
|
|
126638
126692
|
x: Producer['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'],
|
|
126639
126693
|
) => Accepts['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'])
|
|
126694
|
+
| Accepts['FILE_3D_GLB']
|
|
126695
|
+
| Accepts['FILE_3D_OBJ']
|
|
126696
|
+
| Accepts['FILE_3D_FBX']
|
|
126697
|
+
| Accepts['FILE_3D']
|
|
126640
126698
|
'*':
|
|
126641
126699
|
| string
|
|
126642
126700
|
| number
|
|
@@ -126650,18 +126708,27 @@ declare global {
|
|
|
126650
126708
|
| ((
|
|
126651
126709
|
x: Producer['FILE_3D_POINT_CLOUD_ANY,FILE_3D_PLY'],
|
|
126652
126710
|
) => Accepts['FILE_3D_POINT_CLOUD_ANY,FILE_3D_PLY'])
|
|
126711
|
+
| Accepts['FILE_3D_POINT_CLOUD_ANY']
|
|
126712
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126653
126713
|
'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D':
|
|
126654
126714
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D'>
|
|
126655
126715
|
| HasSingle['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D']
|
|
126656
126716
|
| ((x: Producer['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D']) => Accepts['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D'])
|
|
126717
|
+
| Accepts['FILE_3D_GLB']
|
|
126718
|
+
| Accepts['FILE_3D_OBJ']
|
|
126719
|
+
| Accepts['FILE_3D']
|
|
126657
126720
|
'MHR_POSE_DATA,KIMODO_POSE_DATA':
|
|
126658
126721
|
| ComfyNodeOutput<'MHR_POSE_DATA,KIMODO_POSE_DATA'>
|
|
126659
126722
|
| HasSingle['MHR_POSE_DATA,KIMODO_POSE_DATA']
|
|
126660
126723
|
| ((x: Producer['MHR_POSE_DATA,KIMODO_POSE_DATA']) => Accepts['MHR_POSE_DATA,KIMODO_POSE_DATA'])
|
|
126724
|
+
| Accepts['MHR_POSE_DATA']
|
|
126725
|
+
| ComfyNodeOutput<'KIMODO_POSE_DATA'>
|
|
126661
126726
|
'MODEL_TASK_ID,SEGMENT_TASK_ID':
|
|
126662
126727
|
| ComfyNodeOutput<'MODEL_TASK_ID,SEGMENT_TASK_ID'>
|
|
126663
126728
|
| HasSingle['MODEL_TASK_ID,SEGMENT_TASK_ID']
|
|
126664
126729
|
| ((x: Producer['MODEL_TASK_ID,SEGMENT_TASK_ID']) => Accepts['MODEL_TASK_ID,SEGMENT_TASK_ID'])
|
|
126730
|
+
| Accepts['MODEL_TASK_ID']
|
|
126731
|
+
| Accepts['SEGMENT_TASK_ID']
|
|
126665
126732
|
WANVIDEOPROMPTEXTENDER_ARGS:
|
|
126666
126733
|
| ComfyNodeOutput<'WANVIDEOPROMPTEXTENDER_ARGS'>
|
|
126667
126734
|
| HasSingle['WANVIDEOPROMPTEXTENDER_ARGS']
|
|
@@ -126682,10 +126749,17 @@ declare global {
|
|
|
126682
126749
|
| ComfyNodeOutput<'BOUNDING_BOX,ARRAY,STRING'>
|
|
126683
126750
|
| HasSingle['BOUNDING_BOX,ARRAY,STRING']
|
|
126684
126751
|
| ((x: Producer['BOUNDING_BOX,ARRAY,STRING']) => Accepts['BOUNDING_BOX,ARRAY,STRING'])
|
|
126752
|
+
| Accepts['BOUNDING_BOX']
|
|
126753
|
+
| Accepts['ARRAY']
|
|
126754
|
+
| Accepts['STRING']
|
|
126685
126755
|
'INT,FLOAT,STRING,BOOLEAN':
|
|
126686
126756
|
| ComfyNodeOutput<'INT,FLOAT,STRING,BOOLEAN'>
|
|
126687
126757
|
| HasSingle['INT,FLOAT,STRING,BOOLEAN']
|
|
126688
126758
|
| ((x: Producer['INT,FLOAT,STRING,BOOLEAN']) => Accepts['INT,FLOAT,STRING,BOOLEAN'])
|
|
126759
|
+
| Accepts['INT']
|
|
126760
|
+
| Accepts['FLOAT']
|
|
126761
|
+
| Accepts['STRING']
|
|
126762
|
+
| Accepts['BOOLEAN']
|
|
126689
126763
|
FILE_3D_POINT_CLOUD_ANY:
|
|
126690
126764
|
| ComfyNodeOutput<'FILE_3D_POINT_CLOUD_ANY'>
|
|
126691
126765
|
| HasSingle['FILE_3D_POINT_CLOUD_ANY']
|
|
@@ -126750,6 +126824,8 @@ declare global {
|
|
|
126750
126824
|
| ComfyNodeOutput<'SAM3_TRACK_DATA,MASK'>
|
|
126751
126825
|
| HasSingle['SAM3_TRACK_DATA,MASK']
|
|
126752
126826
|
| ((x: Producer['SAM3_TRACK_DATA,MASK']) => Accepts['SAM3_TRACK_DATA,MASK'])
|
|
126827
|
+
| Accepts['SAM3_TRACK_DATA']
|
|
126828
|
+
| Accepts['MASK']
|
|
126753
126829
|
FACE_DETECTION_MODEL:
|
|
126754
126830
|
| ComfyNodeOutput<'FACE_DETECTION_MODEL'>
|
|
126755
126831
|
| HasSingle['FACE_DETECTION_MODEL']
|
|
@@ -126790,6 +126866,8 @@ declare global {
|
|
|
126790
126866
|
| ComfyNodeOutput<'FILE_3D_FBX,FILE_3D'>
|
|
126791
126867
|
| HasSingle['FILE_3D_FBX,FILE_3D']
|
|
126792
126868
|
| ((x: Producer['FILE_3D_FBX,FILE_3D']) => Accepts['FILE_3D_FBX,FILE_3D'])
|
|
126869
|
+
| Accepts['FILE_3D_FBX']
|
|
126870
|
+
| Accepts['FILE_3D']
|
|
126793
126871
|
LUMA_RAY32_KEYFRAME:
|
|
126794
126872
|
| ComfyNodeOutput<'LUMA_RAY32_KEYFRAME'>
|
|
126795
126873
|
| HasSingle['LUMA_RAY32_KEYFRAME']
|
|
@@ -126939,6 +127017,9 @@ declare global {
|
|
|
126939
127017
|
| ComfyNodeOutput<'FLOAT,INT,BOOLEAN'>
|
|
126940
127018
|
| HasSingle['FLOAT,INT,BOOLEAN']
|
|
126941
127019
|
| ((x: Producer['FLOAT,INT,BOOLEAN']) => Accepts['FLOAT,INT,BOOLEAN'])
|
|
127020
|
+
| Accepts['FLOAT']
|
|
127021
|
+
| Accepts['INT']
|
|
127022
|
+
| Accepts['BOOLEAN']
|
|
126942
127023
|
CAMERA_INFO_STATE:
|
|
126943
127024
|
| ComfyNodeOutput<'CAMERA_INFO_STATE'>
|
|
126944
127025
|
| HasSingle['CAMERA_INFO_STATE']
|
|
@@ -126959,6 +127040,9 @@ declare global {
|
|
|
126959
127040
|
| ComfyNodeOutput<'INT,FLOAT,BOOLEAN'>
|
|
126960
127041
|
| HasSingle['INT,FLOAT,BOOLEAN']
|
|
126961
127042
|
| ((x: Producer['INT,FLOAT,BOOLEAN']) => Accepts['INT,FLOAT,BOOLEAN'])
|
|
127043
|
+
| Accepts['INT']
|
|
127044
|
+
| Accepts['FLOAT']
|
|
127045
|
+
| Accepts['BOOLEAN']
|
|
126962
127046
|
SELECTEDDITBLOCKS:
|
|
126963
127047
|
| ComfyNodeOutput<'SELECTEDDITBLOCKS'>
|
|
126964
127048
|
| HasSingle['SELECTEDDITBLOCKS']
|
|
@@ -127458,6 +127542,8 @@ declare global {
|
|
|
127458
127542
|
| ComfyNodeOutput<'LATENT,IMAGE'>
|
|
127459
127543
|
| HasSingle['LATENT,IMAGE']
|
|
127460
127544
|
| ((x: Producer['LATENT,IMAGE']) => Accepts['LATENT,IMAGE'])
|
|
127545
|
+
| Accepts['LATENT']
|
|
127546
|
+
| Accepts['IMAGE']
|
|
127461
127547
|
FREEINITARGS:
|
|
127462
127548
|
| ComfyNodeOutput<'FREEINITARGS'>
|
|
127463
127549
|
| HasSingle['FREEINITARGS']
|
|
@@ -127622,10 +127708,14 @@ declare global {
|
|
|
127622
127708
|
| ComfyNodeOutput<'IMAGE,VIDEO'>
|
|
127623
127709
|
| HasSingle['IMAGE,VIDEO']
|
|
127624
127710
|
| ((x: Producer['IMAGE,VIDEO']) => Accepts['IMAGE,VIDEO'])
|
|
127711
|
+
| Accepts['IMAGE']
|
|
127712
|
+
| Accepts['VIDEO']
|
|
127625
127713
|
'IMAGE,MASK':
|
|
127626
127714
|
| ComfyNodeOutput<'IMAGE,MASK'>
|
|
127627
127715
|
| HasSingle['IMAGE,MASK']
|
|
127628
127716
|
| ((x: Producer['IMAGE,MASK']) => Accepts['IMAGE,MASK'])
|
|
127717
|
+
| Accepts['IMAGE']
|
|
127718
|
+
| Accepts['MASK']
|
|
127629
127719
|
LORA_MODEL:
|
|
127630
127720
|
| ComfyNodeOutput<'LORA_MODEL'>
|
|
127631
127721
|
| HasSingle['LORA_MODEL']
|
|
@@ -127666,6 +127756,8 @@ declare global {
|
|
|
127666
127756
|
| ComfyNodeOutput<'MODEL,CLIP'>
|
|
127667
127757
|
| HasSingle['MODEL,CLIP']
|
|
127668
127758
|
| ((x: Producer['MODEL,CLIP']) => Accepts['MODEL,CLIP'])
|
|
127759
|
+
| Accepts['MODEL']
|
|
127760
|
+
| Accepts['CLIP']
|
|
127669
127761
|
LTX_BLOCKS:
|
|
127670
127762
|
| ComfyNodeOutput<'LTX_BLOCKS'>
|
|
127671
127763
|
| HasSingle['LTX_BLOCKS']
|
|
@@ -127722,6 +127814,8 @@ declare global {
|
|
|
127722
127814
|
| ComfyNodeOutput<'FLOAT,INT'>
|
|
127723
127815
|
| HasSingle['FLOAT,INT']
|
|
127724
127816
|
| ((x: Producer['FLOAT,INT']) => Accepts['FLOAT,INT'])
|
|
127817
|
+
| Accepts['FLOAT']
|
|
127818
|
+
| Accepts['INT']
|
|
127725
127819
|
HISTOGRAM:
|
|
127726
127820
|
| ComfyNodeOutput<'HISTOGRAM'>
|
|
127727
127821
|
| HasSingle['HISTOGRAM']
|
|
@@ -127826,6 +127920,8 @@ declare global {
|
|
|
127826
127920
|
| ComfyNodeOutput<'INT,FLOAT'>
|
|
127827
127921
|
| HasSingle['INT,FLOAT']
|
|
127828
127922
|
| ((x: Producer['INT,FLOAT']) => Accepts['INT,FLOAT'])
|
|
127923
|
+
| Accepts['INT']
|
|
127924
|
+
| Accepts['FLOAT']
|
|
127829
127925
|
BBOX_LIST:
|
|
127830
127926
|
| ComfyNodeOutput<'BBOX_LIST'>
|
|
127831
127927
|
| HasSingle['BBOX_LIST']
|
|
@@ -128046,7 +128142,12 @@ declare global {
|
|
|
128046
128142
|
CURVE: ComfyNodeOutput<'CURVE'> | HasSingle['CURVE'] | ((x: Producer['CURVE']) => Accepts['CURVE'])
|
|
128047
128143
|
SPLAT: ComfyNodeOutput<'SPLAT'> | HasSingle['SPLAT'] | ((x: Producer['SPLAT']) => Accepts['SPLAT'])
|
|
128048
128144
|
TIMER: ComfyNodeOutput<'TIMER'> | HasSingle['TIMER'] | ((x: Producer['TIMER']) => Accepts['TIMER'])
|
|
128049
|
-
'BBOX,':
|
|
128145
|
+
'BBOX,':
|
|
128146
|
+
| ComfyNodeOutput<'BBOX,'>
|
|
128147
|
+
| HasSingle['BBOX,']
|
|
128148
|
+
| ((x: Producer['BBOX,']) => Accepts['BBOX,'])
|
|
128149
|
+
| Accepts['BBOX']
|
|
128150
|
+
| ComfyNodeOutput<''>
|
|
128050
128151
|
VQVAE: ComfyNodeOutput<'VQVAE'> | HasSingle['VQVAE'] | ((x: Producer['VQVAE']) => Accepts['VQVAE'])
|
|
128051
128152
|
BYTES: ComfyNodeOutput<'BYTES'> | HasSingle['BYTES'] | ((x: Producer['BYTES']) => Accepts['BYTES'])
|
|
128052
128153
|
CLIP: ComfyNodeOutput<'CLIP'> | HasSingle['CLIP'] | ((x: Producer['CLIP']) => Accepts['CLIP'])
|
|
@@ -2,42 +2,22 @@
|
|
|
2
2
|
// an entry runs only when the host has its nodes AND its weight files (checked live, see `availability`).
|
|
3
3
|
// depth outputs follow one convention so the grid compares like with like: near = white.
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
|
-
import type { BaseNode,
|
|
5
|
+
import type { BaseNode, ChoiceOptionLook } from 'comfy-ts'
|
|
6
|
+
import { base, type CatalogEntry, type WeightFile } from '../explorer-kit/catalog.ts'
|
|
7
|
+
import type { ExplorerImg as Img, ExplorerWf as W } from '../explorer-kit/server.ts'
|
|
6
8
|
|
|
7
|
-
export type HostId = 'windows-1'
|
|
8
|
-
type W = ComfyWorkflow<HostId>
|
|
9
9
|
type B = W['builder']
|
|
10
|
-
type Img = Comfy.Windows1.Accepts['IMAGE']
|
|
11
10
|
|
|
12
11
|
export type ModelKind = 'depth' | 'normal' | 'material'
|
|
13
12
|
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export type ModelEntry = {
|
|
18
|
-
id: string
|
|
19
|
-
label: string
|
|
20
|
-
family: string
|
|
21
|
-
year: number
|
|
22
|
-
/** when it came out, as precise as known: `2025-11` */
|
|
23
|
-
date: string
|
|
24
|
-
/** its weights on disk */
|
|
25
|
-
size: string
|
|
26
|
-
/** 1 (rough) to 5 (the best of its kind), judged on the explorer's samples */
|
|
27
|
-
quality: number
|
|
28
|
-
/** one run at detail 768 on an RTX class GPU, weights loaded */
|
|
29
|
-
speed: string
|
|
13
|
+
/** `speed`: one run at detail 768; controlnet_aux nodes download their weights on the first run,
|
|
14
|
+
* so their `files` stay empty */
|
|
15
|
+
export type ModelEntry = CatalogEntry & {
|
|
30
16
|
/** materials: the map it gives the relight widget */
|
|
31
17
|
map?: 'albedo' | 'roughness' | 'metalness' | 'specular' | 'shading'
|
|
32
18
|
kind: ModelKind
|
|
33
19
|
/** classic = pre 2023 baselines, off by default */
|
|
34
20
|
tier: 'modern' | 'classic'
|
|
35
|
-
blurb: string
|
|
36
|
-
nodes: string[]
|
|
37
|
-
/** weights the host must list; controlnet_aux nodes download theirs on first run instead */
|
|
38
|
-
files: WeightFile[]
|
|
39
|
-
/** the node pack downloads its weights on the first run (slow once) */
|
|
40
|
-
autoDownload?: boolean
|
|
41
21
|
/** the graph up to its output image; the server adds the websocket save node */
|
|
42
22
|
build: (b: B, image: Img, p: { detail: number; wf: W }) => Img | BaseNode
|
|
43
23
|
}
|
|
@@ -142,13 +122,6 @@ const mogeGeometry = (b: B, image: Img, detail: number) =>
|
|
|
142
122
|
refine_steps: 0,
|
|
143
123
|
})
|
|
144
124
|
|
|
145
|
-
/** a factory of the base (untyped) builder, or a loud error naming the node */
|
|
146
|
-
function base(wf: W, name: string): BaseNodeFactory {
|
|
147
|
-
const f = wf.builderBase[name]
|
|
148
|
-
if (f == null) throw new Error(`this host has no ${name} node`)
|
|
149
|
-
return f
|
|
150
|
-
}
|
|
151
|
-
|
|
152
125
|
/** the Marigold v2 blueprint (Comfy-Org): one flow step on a qwen image edit base + a task lora.
|
|
153
126
|
* built on the BASE builder: its weight names are not in the host sdk until they are downloaded */
|
|
154
127
|
const marigold = (wf: W, image: Img, task: MarigoldTask): BaseNode => {
|
|
@@ -697,26 +670,3 @@ export function optionLook(m: ModelEntry): ChoiceOptionLook {
|
|
|
697
670
|
...(m.tier === 'classic' ? { tags: ['classic'] } : {}),
|
|
698
671
|
}
|
|
699
672
|
}
|
|
700
|
-
|
|
701
|
-
/** raw object_info, as the host schema keeps it */
|
|
702
|
-
type ObjectInfo = Record<string, { input?: { required?: Record<string, unknown>; optional?: Record<string, unknown> } }>
|
|
703
|
-
|
|
704
|
-
/** the options of a COMBO input in both object_info spellings: [[...]] and ['COMBO', { options }] */
|
|
705
|
-
function comboOptions(info: ObjectInfo, node: string, input: string): string[] {
|
|
706
|
-
const def = info[node]?.input
|
|
707
|
-
const slot = def?.required?.[input] ?? def?.optional?.[input]
|
|
708
|
-
if (!Array.isArray(slot)) return []
|
|
709
|
-
const head: unknown = slot[0]
|
|
710
|
-
if (Array.isArray(head)) return head.filter((x): x is string => typeof x === 'string')
|
|
711
|
-
const meta: unknown = slot[1]
|
|
712
|
-
const opts: unknown = typeof meta === 'object' && meta != null && 'options' in meta ? meta.options : null
|
|
713
|
-
return Array.isArray(opts) ? opts.filter((x): x is string => typeof x === 'string') : []
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
export type Availability = { ok: boolean; missingNodes: string[]; missingFiles: WeightFile[] }
|
|
717
|
-
|
|
718
|
-
export function availability(info: ObjectInfo, m: ModelEntry): Availability {
|
|
719
|
-
const missingNodes = m.nodes.filter((n) => info[n] == null)
|
|
720
|
-
const missingFiles = m.files.filter((f) => !comboOptions(info, f.node, f.input).includes(f.file))
|
|
721
|
-
return { ok: missingNodes.length === 0 && missingFiles.length === 0, missingNodes, missingFiles }
|
|
722
|
-
}
|
|
@@ -1,140 +1,19 @@
|
|
|
1
1
|
// depth explorer: drop any image, run every depth / normal estimator the host has, compare them
|
|
2
2
|
// side by side, as a 3D relief or relit by the normals.
|
|
3
3
|
// bun examples/depth-explorer/serve.ts [--samples <dir>] → http://127.0.0.1:8292
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { readdirSync } from 'node:fs'
|
|
7
|
-
import { ComfyTS, exampleImagePath, MediaImage } from 'comfy-ts'
|
|
8
|
-
import { basename, dirname, resolve } from 'pathe'
|
|
9
|
-
import { availability, MODELS, type HostId } from './models.ts'
|
|
4
|
+
import { serveExplorer } from '../explorer-kit/server.ts'
|
|
5
|
+
import { MODELS } from './models.ts'
|
|
10
6
|
import page from './web/index.html'
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** uploaded source images, by content hash (the page sends each one once) */
|
|
22
|
-
const images = new Map<string, Uint8Array>()
|
|
23
|
-
|
|
24
|
-
/** the bundled example images, plus every `--samples <dir>` given: name → file */
|
|
25
|
-
const samplePaths = new Map<string, string>()
|
|
26
|
-
const sampleDirs = [dirname(exampleImagePath('dog_512x512.jpg'))]
|
|
27
|
-
for (let i = 2; i < process.argv.length; i++)
|
|
28
|
-
if (process.argv[i] === '--samples' && process.argv[i + 1] != null)
|
|
29
|
-
sampleDirs.push(resolve(String(process.argv[++i])))
|
|
30
|
-
for (const dir of sampleDirs)
|
|
31
|
-
for (const f of readdirSync(dir)) if (/\.(jpe?g|png|webp)$/i.test(f)) samplePaths.set(f, `${dir}/${f}`)
|
|
32
|
-
const samples = [...samplePaths.keys()]
|
|
33
|
-
|
|
34
|
-
const json = (data: unknown, status = 200): Response => Response.json(data, { status })
|
|
35
|
-
|
|
36
|
-
function modelsPayload(): unknown {
|
|
37
|
-
const info = host.schema.data.spec
|
|
38
|
-
return {
|
|
39
|
-
host: HOST_ID,
|
|
40
|
-
models: MODELS.map((m) => ({
|
|
41
|
-
id: m.id,
|
|
42
|
-
label: m.label,
|
|
43
|
-
family: m.family,
|
|
44
|
-
year: m.year,
|
|
45
|
-
kind: m.kind,
|
|
46
|
-
tier: m.tier,
|
|
47
|
-
blurb: m.blurb,
|
|
48
|
-
date: m.date,
|
|
49
|
-
size: m.size,
|
|
50
|
-
quality: m.quality,
|
|
51
|
-
speed: m.speed,
|
|
52
|
-
autoDownload: m.autoDownload === true,
|
|
53
|
-
...availability(info, m),
|
|
54
|
-
})),
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type RunBody = { image: string; model: string; detail: number }
|
|
59
|
-
|
|
60
|
-
function readRunBody(raw: unknown): RunBody {
|
|
61
|
-
const r = raw as Partial<RunBody> | null
|
|
62
|
-
if (r == null || typeof r.image !== 'string' || typeof r.model !== 'string' || typeof r.detail !== 'number')
|
|
63
|
-
throw new Error('body must be { image: string, model: string, detail: number }')
|
|
64
|
-
return { image: r.image, model: r.model, detail: Math.min(2048, Math.max(256, Math.round(r.detail))) }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function run(body: RunBody): Promise<Response> {
|
|
68
|
-
const model = MODELS.find((m) => m.id === body.model)
|
|
69
|
-
if (model == null) return json({ error: `unknown model ${body.model}` }, 404)
|
|
70
|
-
const avail = availability(host.schema.data.spec, model)
|
|
71
|
-
if (!avail.ok) return json({ error: 'not on this host', ...avail }, 409)
|
|
72
|
-
const bytes = images.get(body.image)
|
|
73
|
-
if (bytes == null) return json({ error: 'unknown image, upload it again' }, 404)
|
|
74
|
-
|
|
75
|
-
const started = performance.now()
|
|
76
|
-
const wf = host.workflow({ id: `depth-explorer-${model.id}` })
|
|
77
|
-
const loaded = await new MediaImage({ buffer: bytes }).loadInWorkflow_viaLoadImageNode(wf)
|
|
78
|
-
const out = model.build(wf.builder, loaded, { detail: body.detail, wf })
|
|
79
|
-
const save = wf.builderBase.SaveImageWebsocket
|
|
80
|
-
if (save == null) throw new Error('this host has no SaveImageWebsocket node')
|
|
81
|
-
save({ images: out })
|
|
82
|
-
// SaveImageWebsocket: the result never touches the server disk; the source image is uploaded
|
|
83
|
-
// once (hash named) and reused by every model
|
|
84
|
-
const execution = await wf.run({ scrubHistory: true })
|
|
85
|
-
const ms = Math.round(performance.now() - started)
|
|
86
|
-
const first = execution.images[0]
|
|
87
|
-
if (execution.status !== 'Success' || first == null) {
|
|
88
|
-
// ComfyUI's own reason (a missing weight, an oom) sits in the error message's data
|
|
89
|
-
const err = execution.data.error
|
|
90
|
-
const message =
|
|
91
|
-
err != null && 'exception_message' in err.data
|
|
92
|
-
? `${err.data.node_type ?? 'a node'}: ${err.data.exception_message}`
|
|
93
|
-
: `run ended ${execution.status}, no image`
|
|
94
|
-
console.error(`🔴 ${model.id}: ${message}`)
|
|
95
|
-
return json({ error: message, ms }, 500)
|
|
96
|
-
}
|
|
97
|
-
console.log(`🟢 ${model.id} ${ms} ms`)
|
|
98
|
-
return new Response(first.buffer as Uint8Array<ArrayBuffer>, {
|
|
99
|
-
headers: { 'content-type': `image/${first.metadata.type ?? 'png'}`, 'x-ms': String(ms) },
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const server = Bun.serve({
|
|
104
|
-
port: PORT,
|
|
105
|
-
hostname: '127.0.0.1',
|
|
106
|
-
development: true,
|
|
107
|
-
idleTimeout: 255, // a cold model load on the GPU box takes minutes
|
|
108
|
-
routes: {
|
|
109
|
-
'/': page,
|
|
110
|
-
'/api/models': () => json(modelsPayload()),
|
|
111
|
-
'/api/samples': () => json(samples),
|
|
112
|
-
'/api/samples/:name': (req) => {
|
|
113
|
-
const path = samplePaths.get(basename(req.params.name))
|
|
114
|
-
if (path == null) return json({ error: 'no such sample' }, 404)
|
|
115
|
-
return new Response(Bun.file(path))
|
|
116
|
-
},
|
|
117
|
-
'/api/image': {
|
|
118
|
-
POST: async (req) => {
|
|
119
|
-
const bytes = new Uint8Array(await req.arrayBuffer())
|
|
120
|
-
if (bytes.length === 0) return json({ error: 'empty body' }, 400)
|
|
121
|
-
const key = createHash('sha1').update(bytes).digest('hex').slice(0, 16)
|
|
122
|
-
images.set(key, bytes)
|
|
123
|
-
return json({ key })
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
'/api/run': {
|
|
127
|
-
POST: async (req) => {
|
|
128
|
-
try {
|
|
129
|
-
return await run(readRunBody(await req.json()))
|
|
130
|
-
} catch (e) {
|
|
131
|
-
const message = e instanceof Error ? e.message : String(e)
|
|
132
|
-
console.error('🔴 run failed:', message)
|
|
133
|
-
return json({ error: message }, 500)
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
},
|
|
8
|
+
await serveExplorer({
|
|
9
|
+
name: 'depth explorer',
|
|
10
|
+
port: 8292,
|
|
11
|
+
page,
|
|
12
|
+
catalog: MODELS,
|
|
13
|
+
card: (m) => ({ kind: m.kind, tier: m.tier }),
|
|
14
|
+
readParams: (raw) => {
|
|
15
|
+
if (typeof raw.detail !== 'number') throw new Error('body needs { detail: number }')
|
|
16
|
+
return { detail: Math.min(2048, Math.max(256, Math.round(raw.detail))) }
|
|
137
17
|
},
|
|
18
|
+
build: (wf, image, m, p) => m.build(wf.builder, image, { detail: p.detail, wf }),
|
|
138
19
|
})
|
|
139
|
-
|
|
140
|
-
console.log(`depth explorer → http://127.0.0.1:${server.port}/ (host ${HOST_ID})`)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { observer } from 'mobx-react-lite'
|
|
2
|
-
import { useEffect, useRef, useState
|
|
2
|
+
import { useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { RunBody, Seg, SourcePicker, timeOf } from '../../explorer-kit/web/ui.tsx'
|
|
3
4
|
import { GlView, type GlParams } from './gl.ts'
|
|
4
5
|
import { greyDepth, loadImage, paintDepth } from './pixels.ts'
|
|
5
6
|
import { RelightWidgetView } from '../../../src/cli/serve/web/widgets/RelightWidget.tsx'
|
|
@@ -42,44 +43,18 @@ const Card = observer(function Card(p: { st: AppSt; model: ModelInfo }) {
|
|
|
42
43
|
const { st, model } = p
|
|
43
44
|
const r = st.result(model.id)
|
|
44
45
|
const aspect = st.source != null ? `${st.source.width} / ${st.source.height}` : '1'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
} else if (r == null) {
|
|
59
|
-
body = (
|
|
60
|
-
<button className="ghost" onClick={() => st.enqueue(model.id)} disabled={st.source == null}>
|
|
61
|
-
run
|
|
62
|
-
</button>
|
|
63
|
-
)
|
|
64
|
-
} else if (r.status === 'queued') body = <span className="dim">queued</span>
|
|
65
|
-
else if (r.status === 'running')
|
|
66
|
-
body = (
|
|
67
|
-
<span className="dim">
|
|
68
|
-
<span className="spin" /> {((st.now - r.startedAt) / 1000).toFixed(1)} s
|
|
69
|
-
{model.autoDownload && st.now - r.startedAt > 8000 && <small>first run downloads the weights</small>}
|
|
70
|
-
</span>
|
|
71
|
-
)
|
|
72
|
-
else if (r.status === 'error')
|
|
73
|
-
body = (
|
|
74
|
-
<div className="err">
|
|
75
|
-
<span>{r.error}</span>
|
|
76
|
-
<button className="ghost" onClick={() => st.enqueue(model.id)}>
|
|
77
|
-
retry
|
|
78
|
-
</button>
|
|
79
|
-
</div>
|
|
46
|
+
const body =
|
|
47
|
+
r?.status === 'done' && r.url != null ? (
|
|
48
|
+
<MapImage st={st} model={model} url={r.url} />
|
|
49
|
+
) : (
|
|
50
|
+
<RunBody
|
|
51
|
+
model={model}
|
|
52
|
+
run={r}
|
|
53
|
+
now={st.runs.now}
|
|
54
|
+
canRun={st.source != null}
|
|
55
|
+
onRun={() => st.enqueue(model.id)}
|
|
56
|
+
/>
|
|
80
57
|
)
|
|
81
|
-
else if (r.url != null) body = <MapImage st={st} model={model} url={r.url} />
|
|
82
|
-
|
|
83
58
|
const done = r?.status === 'done'
|
|
84
59
|
return (
|
|
85
60
|
<div className={`card ${done ? 'done' : ''} ${model.ok ? '' : 'off'}`}>
|
|
@@ -88,7 +63,7 @@ const Card = observer(function Card(p: { st: AppSt; model: ModelInfo }) {
|
|
|
88
63
|
{model.label} <span className="fam">{model.family}</span>
|
|
89
64
|
</span>
|
|
90
65
|
<span className="meta">
|
|
91
|
-
{
|
|
66
|
+
{done ? `${timeOf(r)} · ` : ''}
|
|
92
67
|
{model.year}
|
|
93
68
|
</span>
|
|
94
69
|
</div>
|
|
@@ -114,62 +89,16 @@ const Section = observer(function Section(p: { st: AppSt; title: string; models:
|
|
|
114
89
|
)
|
|
115
90
|
})
|
|
116
91
|
|
|
117
|
-
function Seg<T extends string | number>(p: { value: T; options: [T, string][]; onChange: (v: T) => void }) {
|
|
118
|
-
return (
|
|
119
|
-
<div className="seg">
|
|
120
|
-
{p.options.map(([v, label]) => (
|
|
121
|
-
<button key={String(v)} className={v === p.value ? 'on' : ''} onClick={() => p.onChange(v)}>
|
|
122
|
-
{label}
|
|
123
|
-
</button>
|
|
124
|
-
))}
|
|
125
|
-
</div>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
92
|
const Sidebar = observer(function Sidebar(p: { st: AppSt }) {
|
|
130
93
|
const { st } = p
|
|
131
|
-
const [drag, setDrag] = useState(false)
|
|
132
|
-
const fileRef = useRef<HTMLInputElement>(null)
|
|
133
|
-
const take = (f: File | undefined): void => {
|
|
134
|
-
if (f != null && f.type.startsWith('image/')) void st.setSource(f, f.name)
|
|
135
|
-
}
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
const onPaste = (e: ClipboardEvent): void => {
|
|
138
|
-
const f = [...(e.clipboardData?.files ?? [])].find((x) => x.type.startsWith('image/'))
|
|
139
|
-
take(f)
|
|
140
|
-
}
|
|
141
|
-
window.addEventListener('paste', onPaste)
|
|
142
|
-
return () => window.removeEventListener('paste', onPaste)
|
|
143
|
-
})
|
|
144
94
|
return (
|
|
145
95
|
<aside>
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
onDragLeave={() => setDrag(false)}
|
|
153
|
-
onDrop={(e) => {
|
|
154
|
-
e.preventDefault()
|
|
155
|
-
setDrag(false)
|
|
156
|
-
take(e.dataTransfer.files[0])
|
|
157
|
-
}}
|
|
158
|
-
onClick={() => fileRef.current?.click()}
|
|
159
|
-
>
|
|
160
|
-
{st.source != null ? <img src={st.source.url} alt={st.source.name} /> : <span>drop an image</span>}
|
|
161
|
-
<input ref={fileRef} type="file" accept="image/*" hidden onChange={(e) => take(e.target.files?.[0])} />
|
|
162
|
-
</div>
|
|
163
|
-
<div className="dim small">
|
|
164
|
-
{st.source != null ? `${st.source.name} · ${st.source.width}×${st.source.height}` : ''}
|
|
165
|
-
<br />
|
|
166
|
-
drop, click or paste an image
|
|
167
|
-
</div>
|
|
168
|
-
<div className="samples">
|
|
169
|
-
{st.samples.map((s) => (
|
|
170
|
-
<img key={s} src={`/api/samples/${s}`} alt={s} title={s} onClick={() => void st.loadSample(s)} />
|
|
171
|
-
))}
|
|
172
|
-
</div>
|
|
96
|
+
<SourcePicker
|
|
97
|
+
source={st.source}
|
|
98
|
+
samples={st.samples}
|
|
99
|
+
onFile={(f, name) => void st.setSource(f, name)}
|
|
100
|
+
onSample={(name) => void st.loadSample(name)}
|
|
101
|
+
/>
|
|
173
102
|
|
|
174
103
|
<label>detail</label>
|
|
175
104
|
<Seg
|