Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,10 @@ def process(user_input):
|
|
| 32 |
log = "\n\n".join([f"{msg.type.upper()}: {msg.content}" for msg in final_state["messages"]])
|
| 33 |
|
| 34 |
html_file, log_file, zip_file = save_files(html, log)
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
return preview, html, log, html_file, log_file, zip_file
|
| 38 |
|
|
@@ -42,11 +45,8 @@ with gr.Blocks() as demo:
|
|
| 42 |
run_btn = gr.Button("Run Agents")
|
| 43 |
|
| 44 |
gr.Markdown("### π Website Preview")
|
|
|
|
| 45 |
|
| 46 |
-
escaped_html = html.replace('"', '"')
|
| 47 |
-
preview_html = gr.HTML(value=f"<iframe srcdoc='{escaped_html}' width='100%' height='600px'></iframe>")
|
| 48 |
-
|
| 49 |
-
|
| 50 |
gr.Markdown("### π₯οΈ Generated HTML Code")
|
| 51 |
html_output = gr.Textbox(lines=15, label="Final HTML")
|
| 52 |
|
|
@@ -65,4 +65,4 @@ with gr.Blocks() as demo:
|
|
| 65 |
)
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
-
demo.launch()
|
|
|
|
| 32 |
log = "\n\n".join([f"{msg.type.upper()}: {msg.content}" for msg in final_state["messages"]])
|
| 33 |
|
| 34 |
html_file, log_file, zip_file = save_files(html, log)
|
| 35 |
+
|
| 36 |
+
# Escape quotes for safe iframe embedding
|
| 37 |
+
escaped_html = html.replace('"', """)
|
| 38 |
+
preview = f"<iframe srcdoc='{escaped_html}' width='100%' height='600px' style='border:1px solid #ccc;'></iframe>"
|
| 39 |
|
| 40 |
return preview, html, log, html_file, log_file, zip_file
|
| 41 |
|
|
|
|
| 45 |
run_btn = gr.Button("Run Agents")
|
| 46 |
|
| 47 |
gr.Markdown("### π Website Preview")
|
| 48 |
+
preview_html = gr.HTML()
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
gr.Markdown("### π₯οΈ Generated HTML Code")
|
| 51 |
html_output = gr.Textbox(lines=15, label="Final HTML")
|
| 52 |
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
+
demo.launch()
|