Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -453,17 +453,17 @@ def validate_and_fix_dot_code(dot_code):
|
|
453 |
|
454 |
def render_dot_code(dot_code, filename=None):
|
455 |
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
except Exception as e:
|
466 |
-
|
467 |
|
468 |
import time
|
469 |
|
|
|
453 |
|
454 |
def render_dot_code(dot_code, filename=None):
|
455 |
|
456 |
+
output_path = os.path.join(IMAGE_DIR, f"{filename}.png")
|
457 |
+
try:
|
458 |
+
src = Source(dot_code, format="png")
|
459 |
+
#rendered_path = src.render(output_path, cleanup=True)
|
460 |
+
src.render(output_path, cleanup=True)
|
461 |
+
#png_path = f"{rendered_path}"
|
462 |
+
#return png_path
|
463 |
+
# Return the web-accessible path
|
464 |
+
return f"/images/{filename}.png"
|
465 |
except Exception as e:
|
466 |
+
return f"Error rendering diagram: {str(e)}"
|
467 |
|
468 |
import time
|
469 |
|