Spaces:
Runtime error
Runtime error
Commit
·
f93c694
1
Parent(s):
e92353b
task: update analysis function to accept list
Browse files
data_collection/analyze_designs.py
CHANGED
@@ -141,11 +141,14 @@ async def analyze_screenshot(design_id: str, design_path: Path, detailed: bool =
|
|
141 |
print(f"Error processing design {design_id}: {str(e)}")
|
142 |
return design_id, None, None, None
|
143 |
|
144 |
-
async def attribute_designs():
|
145 |
"""
|
146 |
Process scraped designs to extract title and author from CSS comments.
|
147 |
Adds these attributes to the existing metadata.json files.
|
148 |
Skips designs that already have both title and author.
|
|
|
|
|
|
|
149 |
"""
|
150 |
designs_dir = Path("scraped_designs")
|
151 |
|
@@ -153,8 +156,13 @@ async def attribute_designs():
|
|
153 |
print("Scraped designs directory not found!")
|
154 |
return
|
155 |
|
156 |
-
# Get
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
if not design_dirs:
|
160 |
print("No design directories found!")
|
|
|
141 |
print(f"Error processing design {design_id}: {str(e)}")
|
142 |
return design_id, None, None, None
|
143 |
|
144 |
+
async def attribute_designs(design_ids: list[str] = None):
|
145 |
"""
|
146 |
Process scraped designs to extract title and author from CSS comments.
|
147 |
Adds these attributes to the existing metadata.json files.
|
148 |
Skips designs that already have both title and author.
|
149 |
+
|
150 |
+
Args:
|
151 |
+
design_ids (list[str], optional): List of design IDs to process. If None, processes all designs.
|
152 |
"""
|
153 |
designs_dir = Path("scraped_designs")
|
154 |
|
|
|
156 |
print("Scraped designs directory not found!")
|
157 |
return
|
158 |
|
159 |
+
# Get design directories based on provided IDs or all directories
|
160 |
+
if design_ids:
|
161 |
+
design_dirs = [designs_dir / design_id for design_id in design_ids]
|
162 |
+
print(f"Processing {len(design_dirs)} specified designs")
|
163 |
+
else:
|
164 |
+
design_dirs = [d for d in designs_dir.iterdir() if d.is_dir()]
|
165 |
+
print(f"Found {len(design_dirs)} designs to check")
|
166 |
|
167 |
if not design_dirs:
|
168 |
print("No design directories found!")
|