Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -475,6 +475,7 @@ class TemplateManager:
|
|
| 475 |
|
| 476 |
def load_templates(self):
|
| 477 |
"""Load built-in templates"""
|
|
|
|
| 478 |
self.templates = {
|
| 479 |
"image_classifier": Template(
|
| 480 |
code="""
|
|
@@ -1484,10 +1485,10 @@ class TemplateManager:
|
|
| 1484 |
)
|
| 1485 |
}
|
| 1486 |
|
| 1487 |
-
|
| 1488 |
self._build_component_index()
|
| 1489 |
self._build_category_index()
|
| 1490 |
-
|
| 1491 |
def _build_component_index(self):
|
| 1492 |
"""Build index of templates by component"""
|
| 1493 |
self.component_index = {}
|
|
@@ -1496,7 +1497,7 @@ class TemplateManager:
|
|
| 1496 |
if component not in self.component_index:
|
| 1497 |
self.component_index[component] = []
|
| 1498 |
self.component_index[component].append(name)
|
| 1499 |
-
|
| 1500 |
def _build_category_index(self):
|
| 1501 |
"""Build index of templates by category"""
|
| 1502 |
self.category_index = {}
|
|
|
|
| 475 |
|
| 476 |
def load_templates(self):
|
| 477 |
"""Load built-in templates"""
|
| 478 |
+
# Load built-in templates
|
| 479 |
self.templates = {
|
| 480 |
"image_classifier": Template(
|
| 481 |
code="""
|
|
|
|
| 1485 |
)
|
| 1486 |
}
|
| 1487 |
|
| 1488 |
+
# Build indexes after loading templates
|
| 1489 |
self._build_component_index()
|
| 1490 |
self._build_category_index()
|
| 1491 |
+
|
| 1492 |
def _build_component_index(self):
|
| 1493 |
"""Build index of templates by component"""
|
| 1494 |
self.component_index = {}
|
|
|
|
| 1497 |
if component not in self.component_index:
|
| 1498 |
self.component_index[component] = []
|
| 1499 |
self.component_index[component].append(name)
|
| 1500 |
+
|
| 1501 |
def _build_category_index(self):
|
| 1502 |
"""Build index of templates by category"""
|
| 1503 |
self.category_index = {}
|