Spaces:
Running
Running
Commit
·
c897576
1
Parent(s):
30684c6
retrieve
Browse files
app.py
CHANGED
|
@@ -67,9 +67,7 @@ def render_preview(code: str, width: int, height: int, scale: float) -> str:
|
|
| 67 |
"""
|
| 68 |
Preview renderer with both width and height control for the inner canvas.
|
| 69 |
"""
|
| 70 |
-
# Simple HTML escaping for now to avoid potential issues
|
| 71 |
safe_code = html.escape(code).replace("'", "'")
|
| 72 |
-
|
| 73 |
iframe_html = f"""
|
| 74 |
<div style="width: 100%; max-width: 1920px; margin: 0 auto; overflow-x: auto; overflow-y: hidden;">
|
| 75 |
<div style="
|
|
@@ -134,11 +132,6 @@ def process_and_generate(image_np, image_path_from_state, sidebar_prompt, header
|
|
| 134 |
|
| 135 |
print(f"Processing HTML for run_id: {run_id}")
|
| 136 |
|
| 137 |
-
# Simple cleanup for now - just remove obvious problematic references
|
| 138 |
-
html_content = html_content.replace('index-BQPjLIsY.js', '')
|
| 139 |
-
html_content = html_content.replace('index-BOW2xVAS.css', '')
|
| 140 |
-
html_content = html_content.replace('iframeResizer', '')
|
| 141 |
-
|
| 142 |
for img in soup.find_all('img'):
|
| 143 |
if img.get('src') and not img['src'].startswith(('http', 'data:')):
|
| 144 |
original_src = img['src']
|
|
@@ -274,10 +267,4 @@ for path in allowed_paths:
|
|
| 274 |
print(f" - {path}")
|
| 275 |
|
| 276 |
if __name__ == "__main__":
|
| 277 |
-
demo.launch(
|
| 278 |
-
allowed_paths=allowed_paths,
|
| 279 |
-
show_error=True,
|
| 280 |
-
quiet=False,
|
| 281 |
-
favicon_path=None,
|
| 282 |
-
prevent_thread_lock=True
|
| 283 |
-
)
|
|
|
|
| 67 |
"""
|
| 68 |
Preview renderer with both width and height control for the inner canvas.
|
| 69 |
"""
|
|
|
|
| 70 |
safe_code = html.escape(code).replace("'", "'")
|
|
|
|
| 71 |
iframe_html = f"""
|
| 72 |
<div style="width: 100%; max-width: 1920px; margin: 0 auto; overflow-x: auto; overflow-y: hidden;">
|
| 73 |
<div style="
|
|
|
|
| 132 |
|
| 133 |
print(f"Processing HTML for run_id: {run_id}")
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
for img in soup.find_all('img'):
|
| 136 |
if img.get('src') and not img['src'].startswith(('http', 'data:')):
|
| 137 |
original_src = img['src']
|
|
|
|
| 267 |
print(f" - {path}")
|
| 268 |
|
| 269 |
if __name__ == "__main__":
|
| 270 |
+
demo.launch(allowed_paths=allowed_paths)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|