arkamaldeen commited on
Commit
f0b6757
1 Parent(s): 5c92236

Updated the save button

Browse files
Files changed (1) hide show
  1. app.py +17 -21
app.py CHANGED
@@ -32,7 +32,7 @@ def load_css(file_path):
32
 
33
 
34
  # Load CSS file
35
- # load_css('styles2.css')
36
 
37
 
38
  # ----- FUNCTIONS ----
@@ -318,26 +318,22 @@ def main():
318
 
319
  with col1:
320
  saved_button = False
321
- if st.button("Save", key="b_save"):
322
- file_name = "output.txt"
323
-
324
- # Define the folder path
325
- folder_path = "extracted data"
326
-
327
- # Create the folder if it doesn't exist
328
- os.makedirs(folder_path, exist_ok=True)
329
-
330
- # Define the file path
331
- file_path = os.path.join(folder_path, file_name)
332
- if is_a_sitemap:
333
- saved_data = st.session_state.sitemap_data
334
- # Save string variable to file
335
- with open(file_path, "w", encoding="utf-8") as file:
336
- file.write(saved_data)
337
- else:
338
- with open(file_path, "w", encoding="utf-8") as file:
339
- file.write(data)
340
- saved_button = True
341
 
342
  with col2:
343
  if st.button("Clear"):
 
32
 
33
 
34
  # Load CSS file
35
+ load_css('styles.css')
36
 
37
 
38
  # ----- FUNCTIONS ----
 
318
 
319
  with col1:
320
  saved_button = False
321
+
322
+ if is_a_sitemap:
323
+ saved_data = st.session_state.sitemap_data
324
+
325
+ if st.download_button(
326
+ label="Save",
327
+ data=saved_data
328
+ ):
329
+ saved_button = True
330
+
331
+ else:
332
+ if st.download_button(
333
+ label="Save",
334
+ data=data
335
+ ):
336
+ saved_button = True
 
 
 
 
337
 
338
  with col2:
339
  if st.button("Clear"):