Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,8 +21,8 @@ if uploaded_file is not None:
|
|
21 |
b64 = base64.b64encode(file_content).decode()
|
22 |
st.markdown(f"File successfully uploaded. Here is the download link:")
|
23 |
|
24 |
-
# Create a download link
|
25 |
-
href = f'<a href="data:file/txt;base64,{b64}" download="your_file.txt">Download File</a>'
|
26 |
st.markdown(href, unsafe_allow_html=True)
|
27 |
|
28 |
# Modify app.py
|
@@ -31,5 +31,13 @@ if uploaded_file is not None:
|
|
31 |
with open('app.py', 'w') as f:
|
32 |
f.write(modified_app_code)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# Refresh app
|
35 |
os.system("streamlit rerun")
|
|
|
21 |
b64 = base64.b64encode(file_content).decode()
|
22 |
st.markdown(f"File successfully uploaded. Here is the download link:")
|
23 |
|
24 |
+
# Create a download link for the uploaded file
|
25 |
+
href = f'<a href="data:file/txt;base64,{b64}" download="your_file.txt">Download Uploaded File</a>'
|
26 |
st.markdown(href, unsafe_allow_html=True)
|
27 |
|
28 |
# Modify app.py
|
|
|
31 |
with open('app.py', 'w') as f:
|
32 |
f.write(modified_app_code)
|
33 |
|
34 |
+
# Display the new code in a textbox
|
35 |
+
st.text_area("Newly Modified app.py Code:", modified_app_code)
|
36 |
+
|
37 |
+
# Convert modified app.py to base64 for download
|
38 |
+
app_b64 = base64.b64encode(modified_app_code.encode()).decode()
|
39 |
+
app_href = f'<a href="data:file/py;base64,{app_b64}" download="modified_app.py">Download Modified app.py</a>'
|
40 |
+
st.markdown(app_href, unsafe_allow_html=True)
|
41 |
+
|
42 |
# Refresh app
|
43 |
os.system("streamlit rerun")
|