Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	| import streamlit as st | |
| import json | |
| import os | |
| st.title("Saved Recipes") | |
| # get all saved files | |
| directory_path = '/data/' | |
| saved_files = [] | |
| for root, dirs, files in os.walk(directory_path): | |
| for file in files: | |
| if file.endswith('.json'): | |
| full_path = os.path.join(root, file) | |
| f = open(full_path) | |
| recipe_json = json.load(f) | |
| saved_files.append(recipe_json) | |
| #st.json(saved_files) | |
| for recipe in saved_files: | |
| with st.expander(recipe['name']): | |
| st.markdown(recipe['md']) | |
| # ignore | |
| # f = open('/data/test_output.json') | |
| # json_test = json.load(f) | |
| # st.json(json_test) | |
| # file_path = '/data/test_output.json' | |
| # if os.path.exists(file_path): | |
| # # Delete the file | |
| # os.remove(file_path) | |
| # st.write(f"The file {file_path} has been deleted.") | |
| # else: | |
| # st.write(f"The file {file_path} does not exist.") |