akhaliq HF Staff commited on
Commit
6dcf216
·
1 Parent(s): 6c3760d
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1405,12 +1405,14 @@ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "-
1405
  app_py_path = os.path.join(src_dir, "streamlit_app.py")
1406
 
1407
  # Convert HTML code to Streamlit app
 
 
1408
  streamlit_app_code = f'''import streamlit as st
1409
 
1410
  st.set_page_config(page_title="Generated App", layout="wide")
1411
 
1412
  # Display the HTML content
1413
- html_content = """{code.replace('"""', '\\"""')}"""
1414
 
1415
  st.components.v1.html(html_content, height=800, scrolling=True)
1416
  '''
 
1405
  app_py_path = os.path.join(src_dir, "streamlit_app.py")
1406
 
1407
  # Convert HTML code to Streamlit app
1408
+ # Escape the HTML content properly for the f-string
1409
+ escaped_code = code.replace('"', '\\"').replace('\n', '\\n')
1410
  streamlit_app_code = f'''import streamlit as st
1411
 
1412
  st.set_page_config(page_title="Generated App", layout="wide")
1413
 
1414
  # Display the HTML content
1415
+ html_content = """{escaped_code}"""
1416
 
1417
  st.components.v1.html(html_content, height=800, scrolling=True)
1418
  '''