Rahul-8799 commited on
Commit
ca12d1b
Β·
verified Β·
1 Parent(s): 162b6d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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
- preview = f"<iframe src='file/{html_file}' width='100%' height='500px' style='border:1px solid #ccc;'></iframe>"
 
 
 
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('"', '&quot;')
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('"', "&quot;")
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()