Spaces:
Running
Running
File size: 885 Bytes
5266631 ca13361 80d7df8 4c20be7 f3f69dd 80d7df8 f3f69dd 80d7df8 56dbafa 80d7df8 fea45d9 80d7df8 56dbafa f3f69dd fea45d9 80d7df8 fea45d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
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.") |