Update app.py
Browse files
app.py
CHANGED
|
@@ -143,6 +143,19 @@ if st.button("Save"):
|
|
| 143 |
cv2.imwrite(f"data/{cur}.png", mask)
|
| 144 |
uploaded_image = im.upload_image(f"data/{cur}.png", title=f"Data Backup [GEOIA2024] {cur}")
|
| 145 |
print(uploaded_image.link)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
else:
|
| 147 |
st.warning("Please draw on the image.")
|
| 148 |
|
|
|
|
| 143 |
cv2.imwrite(f"data/{cur}.png", mask)
|
| 144 |
uploaded_image = im.upload_image(f"data/{cur}.png", title=f"Data Backup [GEOIA2024] {cur}")
|
| 145 |
print(uploaded_image.link)
|
| 146 |
+
with open("bkup.txt", "a+") as f:
|
| 147 |
+
f.write(str(uploaded_image.link) + "\n")
|
| 148 |
+
f.close()
|
| 149 |
+
|
| 150 |
+
with open("bkup.txt", "r") as f:
|
| 151 |
+
txt = f.read()
|
| 152 |
+
st.download_button(
|
| 153 |
+
label="Download backup",
|
| 154 |
+
data=txt,
|
| 155 |
+
file_name="bkup.txt",
|
| 156 |
+
mime="text/plain"
|
| 157 |
+
)
|
| 158 |
+
f.close()
|
| 159 |
else:
|
| 160 |
st.warning("Please draw on the image.")
|
| 161 |
|