Image Pipeline Playground
feat: add custom Python sepia example workflow
Mohammad Rajaeief72009128cd
diff --git a/frontend/public/examples/custom_python_sepia.json b/frontend/public/examples/custom_python_sepia.jsonnew file mode 100644index 0000000..8797b34--- /dev/null+++ b/frontend/public/examples/custom_python_sepia.json@@ -0,0 +1,34 @@+{+ "version": 1,+ "name": "custom-python-sepia",+ "description": "Load Lena, then apply a sepia look via inline Custom Python (requires trust before Run).",+ "seed": 0,+ "sampleCount": 1,+ "graph": {+ "nodes": [+ {+ "id": "load-1",+ "type": "load_image",+ "params": { "sample": "lena" },+ "position": { "x": 0, "y": 0 }+ },+ {+ "id": "custom-1",+ "type": "custom_python",+ "params": {+ "code": "def process(image, seed=0):\n # Simple sepia tone (BGR uint8)\n import numpy as np\n b = image[:, :, 0].astype(np.float32)\n g = image[:, :, 1].astype(np.float32)\n r = image[:, :, 2].astype(np.float32)\n tr = 0.393 * r + 0.769 * g + 0.189 * b\n tg = 0.349 * r + 0.686 * g + 0.168 * b\n tb = 0.272 * r + 0.534 * g + 0.131 * b\n out = image.copy()\n out[:, :, 0] = np.clip(tb, 0, 255).astype(np.uint8)\n out[:, :, 1] = np.clip(tg, 0, 255).astype(np.uint8)\n out[:, :, 2] = np.clip(tr, 0, 255).astype(np.uint8)\n return out\n"+ },+ "position": { "x": 220, "y": 0 }+ }+ ],+ "edges": [+ {+ "id": "e1",+ "source": "load-1",+ "source_port": "image",+ "target": "custom-1",+ "target_port": "image"+ }+ ]+ }+}