Spaces:
Sleeping
Sleeping
restoration in progress
Browse files
app.py
CHANGED
|
@@ -95,40 +95,29 @@ with bot:
|
|
| 95 |
st.session_state.get("error_output", "")
|
| 96 |
)
|
| 97 |
|
| 98 |
-
# 7️⃣
|
| 99 |
-
|
| 100 |
-
st.
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
)
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
exec_code = f"{input_stub}
|
| 118 |
-
" + code
|
| 119 |
-
out, err, exc = execute_code(exec_code)
|
| 120 |
-
st.session_state.code_output = out
|
| 121 |
-
st.session_state.error_output = err or exc
|
| 122 |
-
|
| 123 |
-
# Display results
|
| 124 |
-
if st.session_state.get("code_output"):
|
| 125 |
-
st.text_area("Output", st.session_state.code_output, height=120)
|
| 126 |
-
if st.session_state.get("error_output"):
|
| 127 |
-
st.error(st.session_state.error_output)
|
| 128 |
|
| 129 |
# 8️⃣ Footer
|
| 130 |
st.markdown(f"""
|
| 131 |
<div style='text-align:center; margin-top:1rem; color:{TEXT}66;'>
|
| 132 |
Built with ❤️ & Streamlit
|
| 133 |
</div>
|
| 134 |
-
""", unsafe_allow_html=True)
|
|
|
|
| 95 |
st.session_state.get("error_output", "")
|
| 96 |
)
|
| 97 |
|
| 98 |
+
# 7️⃣ Export section
|
| 99 |
+
st.markdown("---")
|
| 100 |
+
st.subheader("Export")
|
| 101 |
+
export_data = export_session(
|
| 102 |
+
code,
|
| 103 |
+
st.session_state.get("code_output", ""),
|
| 104 |
+
st.session_state.get("error_output", "")
|
| 105 |
)
|
| 106 |
+
col1, col2 = st.columns(2)
|
| 107 |
+
with col1:
|
| 108 |
+
st.download_button(
|
| 109 |
+
"📦 JSON",
|
| 110 |
+
data=json.dumps(export_data, indent=2),
|
| 111 |
+
file_name="session.json",
|
| 112 |
+
mime="application/json"
|
| 113 |
+
)
|
| 114 |
+
with col2:
|
| 115 |
+
txt = f"# Code\n{code}\n\n# Output\n{st.session_state.get('code_output','')}\n\n# Errors\n{st.session_state.get('error_output','')}"
|
| 116 |
+
st.download_button("📝 Text", txt, "session.txt", "text/plain")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
# 8️⃣ Footer
|
| 119 |
st.markdown(f"""
|
| 120 |
<div style='text-align:center; margin-top:1rem; color:{TEXT}66;'>
|
| 121 |
Built with ❤️ & Streamlit
|
| 122 |
</div>
|
| 123 |
+
""", unsafe_allow_html=True)
|