diff --git a/notebooks/hierarchy_inference.ipynb b/notebooks/hierarchy_inference.ipynb index 38f980d..362d1f2 100644 --- a/notebooks/hierarchy_inference.ipynb +++ b/notebooks/hierarchy_inference.ipynb @@ -50,7 +50,8 @@ "First, we will load an example project and select a frame / board from a page for hierarchy generation. The current approach works on frame, respectively board level to reduce the number of shapes in a single prompt but also as boards within Penpot are typically supposed to act as logical separations of sub-designs within a single page and therefore can serve as point of reference for the LLM.\n", "\n", "Note, that the hierarchy generation works for some files and designs better than others. If a design inherently has a clear and hierarchical structure, our inference algorithm will do a pretty good job transferring this visual information into a formal structure. In cases with little inherent structure, e.g. a grid of icons, the generated hierarchies might be flat or of little information." - ] + ], + "execution_count": 1 }, { "cell_type": "code", @@ -66,7 +67,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "Scanning remote paths in penpot/data/raw/designs/Material Design 3: 100%|██████████| 36/36 [00:00<00:00, 532.68it/s]\n", + "Scanning remote paths in penpot/data/raw/designs/Material Design 3: 100%|\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6| 36/36 [00:00<00:00, 532.68it/s]\n", "force pulling (bytes): 0it [00:00, ?it/s]\n" ] } @@ -81,7 +82,8 @@ "metadata": {}, "source": [ "Next, we perform two important steps: removal of invisible elements and bounding box derivation. The first one is important as invisible shapes such as pure group elements that don't correspond to any visible elements can't be visually recognized by the VLM. The bounding box derivation is necessary to construct \"snippets\" of rendered elements that will be provided each separately for guiding the hierarchy generation." - ] + ], + "execution_count": 1 }, { "cell_type": "code", @@ -97,7 +99,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "Setting view boxes: 100%|██████████| 163/163 [00:03<00:00, 52.87it/s] \n" + "Setting view boxes: 100%|\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6| 163/163 [00:03<00:00, 52.87it/s] \n" ] } ], @@ -111,7 +113,8 @@ "metadata": {}, "source": [ "Finally we will retrieve the \"Cover\" board which is the only frame in this document and covers the whole page." - ] + ], + "execution_count": 1 }, { "cell_type": "code", @@ -132,7 +135,8 @@ "metadata": {}, "source": [ "To now perform the hierarchy generation, we will instantiate a `HierarchyInferencer` object with a LLM of our choice and pass the prepared shape to its `infer_shape_hierarchy()`-method:" - ] + ], + "execution_count": 1 }, { "cell_type": "code", @@ -527,7 +531,8 @@ "If the cell above finishes without errors, it indicates that the hierarchy has been derived successfully. The underlying code performs a validation of the AI response to ensure that the response format is correct (i.e. syntactically correct JSON) but also that the generated hierarchy is valid, i.e. all shapes are covered and no duplicate shapes are present.\n", "\n", "We can finally use the `InteractiveSVGHierarchyVisualizer` utility-class to visualize the generated hierarchy interactively within this notebook:" - ] + ], + "execution_count": 1 }, { "cell_type": "code", @@ -571,7 +576,8 @@ "source": [], "metadata": { "collapsed": false - } + }, + "execution_count": 1 } ], "metadata": { @@ -595,4 +601,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/notebooks/svg_variations_ui_widget.ipynb b/notebooks/svg_variations_ui_widget.ipynb index 826033a..1b32d27 100644 --- a/notebooks/svg_variations_ui_widget.ipynb +++ b/notebooks/svg_variations_ui_widget.ipynb @@ -43,7 +43,8 @@ "metadata": { "collapsed": false }, - "id": "507b8a0dc6422eea" + "id": "507b8a0dc6422eea", + "execution_count": 1 }, { "cell_type": "code", @@ -52,7 +53,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "Scanning remote paths in penpot/data/raw/designs/Generative variations: 100%|██████████| 4/4 [00:00<00:00, 999.89it/s]\n", + "Scanning remote paths in penpot/data/raw/designs/Generative variations: 100%|\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6\u00e2\u2013\u02c6| 4/4 [00:00<00:00, 999.89it/s]\n", "force pulling (bytes): 0it [00:00, ?it/s]\n" ] } @@ -81,7 +82,8 @@ "metadata": { "collapsed": false }, - "id": "ea8bb1f54f860125" + "id": "ea8bb1f54f860125", + "execution_count": 1 }, { "cell_type": "code", @@ -445,7 +447,8 @@ "metadata": { "collapsed": false }, - "id": "e067c526e558256" + "id": "e067c526e558256", + "execution_count": 1 }, { "cell_type": "code", @@ -840,7 +843,8 @@ "metadata": { "collapsed": false }, - "id": "2f5d3c1a3f30167f" + "id": "2f5d3c1a3f30167f", + "execution_count": 1 }, { "cell_type": "code", @@ -1230,7 +1234,8 @@ "metadata": { "collapsed": false }, - "id": "407a20e11a411be6" + "id": "407a20e11a411be6", + "execution_count": 1 } ], "metadata": { @@ -1254,4 +1259,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file