Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,4 +76,22 @@ if submitted:
|
|
| 76 |
st.text(result)
|
| 77 |
|
| 78 |
# CSV export
|
| 79 |
-
csv_buffer = io.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
st.text(result)
|
| 77 |
|
| 78 |
# CSV export
|
| 79 |
+
csv_buffer = io.StringIO()
|
| 80 |
+
writer = csv.writer(csv_buffer)
|
| 81 |
+
writer.writerow(["Material", "Quantity"])
|
| 82 |
+
|
| 83 |
+
for line in result.splitlines():
|
| 84 |
+
if ":" in line:
|
| 85 |
+
parts = line.split(":", 1)
|
| 86 |
+
writer.writerow([parts[0].strip(), parts[1].strip()])
|
| 87 |
+
|
| 88 |
+
st.download_button(
|
| 89 |
+
label="馃摜 Download Estimate",
|
| 90 |
+
data=csv_buffer.getvalue(),
|
| 91 |
+
file_name="buildsmart_estimate.csv",
|
| 92 |
+
mime="text/csv"
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
# Footer
|
| 96 |
+
st.markdown("---")
|
| 97 |
+
st.caption("Powered by Groq 路 Securely using Streamlit secrets")
|