Skip to content

Commit

Permalink
Add further missing execution counts
Browse files Browse the repository at this point in the history
  • Loading branch information
opcode81 committed Jul 10, 2024
1 parent a3829aa commit 99afd59
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
24 changes: 15 additions & 9 deletions notebooks/hierarchy_inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
]
}
Expand All @@ -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",
Expand All @@ -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"
]
}
],
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -571,7 +576,8 @@
"source": [],
"metadata": {
"collapsed": false
}
},
"execution_count": 1
}
],
"metadata": {
Expand All @@ -595,4 +601,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
19 changes: 12 additions & 7 deletions notebooks/svg_variations_ui_widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"metadata": {
"collapsed": false
},
"id": "507b8a0dc6422eea"
"id": "507b8a0dc6422eea",
"execution_count": 1
},
{
"cell_type": "code",
Expand All @@ -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"
]
}
Expand Down Expand Up @@ -81,7 +82,8 @@
"metadata": {
"collapsed": false
},
"id": "ea8bb1f54f860125"
"id": "ea8bb1f54f860125",
"execution_count": 1
},
{
"cell_type": "code",
Expand Down Expand Up @@ -445,7 +447,8 @@
"metadata": {
"collapsed": false
},
"id": "e067c526e558256"
"id": "e067c526e558256",
"execution_count": 1
},
{
"cell_type": "code",
Expand Down Expand Up @@ -840,7 +843,8 @@
"metadata": {
"collapsed": false
},
"id": "2f5d3c1a3f30167f"
"id": "2f5d3c1a3f30167f",
"execution_count": 1
},
{
"cell_type": "code",
Expand Down Expand Up @@ -1230,7 +1234,8 @@
"metadata": {
"collapsed": false
},
"id": "407a20e11a411be6"
"id": "407a20e11a411be6",
"execution_count": 1
}
],
"metadata": {
Expand All @@ -1254,4 +1259,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}

0 comments on commit 99afd59

Please sign in to comment.