Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1585,15 +1585,16 @@ if __name__ == "__main__":
|
|
1585 |
logger.error(f"Error running application: {e}")
|
1586 |
|
1587 |
def load_templates(self):
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
|
|
1597 |
name = template_file.stem
|
1598 |
self.templates[name] = Template(**template_data)
|
1599 |
except Exception as e:
|
|
|
1585 |
logger.error(f"Error running application: {e}")
|
1586 |
|
1587 |
def load_templates(self):
|
1588 |
+
"""Load all templates from directory"""
|
1589 |
+
try:
|
1590 |
+
# Load built-in templates
|
1591 |
+
self.templates.update(self._get_builtin_templates())
|
1592 |
+
|
1593 |
+
# Load custom templates
|
1594 |
+
for template_file in self.template_dir.glob("*.json"):
|
1595 |
+
try:
|
1596 |
+
with open(template_file, 'r', encoding='utf-8') as f:
|
1597 |
+
template_data = json.load(f)
|
1598 |
name = template_file.stem
|
1599 |
self.templates[name] = Template(**template_data)
|
1600 |
except Exception as e:
|