pcdoido2 commited on
Commit
2600a3c
·
verified ·
1 Parent(s): 1c83fd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -72,7 +72,7 @@ if not files:
72
  st.info("Nenhum arquivo disponível.")
73
  else:
74
  for file in files:
75
- col1, col2, col3 = st.columns([4, 1, 1])
76
  with col1:
77
  expira = expirations.get(file)
78
  if expira:
@@ -86,8 +86,8 @@ else:
86
  else:
87
  st.write(file)
88
  with col2:
89
- with open(os.path.join(UPLOAD_FOLDER, file), "rb") as f:
90
- st.download_button("⬇ Download", f, file_name=file)
91
  with col3:
92
  if st.button("🗑 Excluir", key=f"delete_{file}"):
93
  os.remove(os.path.join(UPLOAD_FOLDER, file))
@@ -96,3 +96,9 @@ else:
96
  json.dump(expirations, f)
97
  st.success(f"Arquivo '{file}' excluído.")
98
  st.rerun()
 
 
 
 
 
 
 
72
  st.info("Nenhum arquivo disponível.")
73
  else:
74
  for file in files:
75
+ col1, col2, col3, col4 = st.columns([4, 1, 1, 2])
76
  with col1:
77
  expira = expirations.get(file)
78
  if expira:
 
86
  else:
87
  st.write(file)
88
  with col2:
89
+ with open(os.path.join(UPLOAD_FOLDER, file), "rb") as f_obj:
90
+ st.download_button("⬇ Download", f_obj, file_name=file)
91
  with col3:
92
  if st.button("🗑 Excluir", key=f"delete_{file}"):
93
  os.remove(os.path.join(UPLOAD_FOLDER, file))
 
96
  json.dump(expirations, f)
97
  st.success(f"Arquivo '{file}' excluído.")
98
  st.rerun()
99
+ with col4:
100
+ with open(os.path.join(UPLOAD_FOLDER, file), "rb") as f_obj:
101
+ if st.download_button("⬇ Baixar & Apagar", f_obj, file_name=file, key=f"download_delete_{file}"):
102
+ os.remove(os.path.join(UPLOAD_FOLDER, file))
103
+ expirations.pop(file, None)
104
+ with open(EXPIRATION_FILE, "w") as f: