Spaces:
Running
Running
update
Browse files
app.py
CHANGED
@@ -1369,7 +1369,7 @@ with gr.Blocks(
|
|
1369 |
# Create a temp dir for the structure
|
1370 |
temp_dir = tempfile.mkdtemp()
|
1371 |
# 1. Write requirements.txt
|
1372 |
-
reqs = "
|
1373 |
req_path = os.path.join(temp_dir, "requirements.txt")
|
1374 |
with open(req_path, "w") as f:
|
1375 |
f.write(reqs)
|
@@ -1403,22 +1403,8 @@ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "-
|
|
1403 |
src_dir = os.path.join(temp_dir, "src")
|
1404 |
os.makedirs(src_dir, exist_ok=True)
|
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 |
-
'''
|
1419 |
-
|
1420 |
with open(app_py_path, "w") as f:
|
1421 |
-
f.write(
|
1422 |
# Prepare files to upload
|
1423 |
files_to_upload = [
|
1424 |
(req_path, "requirements.txt"),
|
|
|
1369 |
# Create a temp dir for the structure
|
1370 |
temp_dir = tempfile.mkdtemp()
|
1371 |
# 1. Write requirements.txt
|
1372 |
+
reqs = "altair\npandas\nstreamlit\n"
|
1373 |
req_path = os.path.join(temp_dir, "requirements.txt")
|
1374 |
with open(req_path, "w") as f:
|
1375 |
f.write(reqs)
|
|
|
1403 |
src_dir = os.path.join(temp_dir, "src")
|
1404 |
os.makedirs(src_dir, exist_ok=True)
|
1405 |
app_py_path = os.path.join(src_dir, "streamlit_app.py")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1406 |
with open(app_py_path, "w") as f:
|
1407 |
+
f.write(code)
|
1408 |
# Prepare files to upload
|
1409 |
files_to_upload = [
|
1410 |
(req_path, "requirements.txt"),
|