recipes_app / pages /2_Saved_Recipes.py
adrianpierce's picture
Update pages/2_Saved_Recipes.py
adf8edf
raw
history blame
628 Bytes
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'])
# f = open('/data/test_output.json')
# json_test = json.load(f)
# st.json(json_test)