Spaces:
Runtime error
Runtime error
Commit
·
fea45d9
1
Parent(s):
e0b7cd5
Update pages/2_Saved_Recipes.py
Browse files- pages/2_Saved_Recipes.py +13 -14
pages/2_Saved_Recipes.py
CHANGED
|
@@ -4,18 +4,6 @@ import os
|
|
| 4 |
|
| 5 |
st.title("Saved Recipes")
|
| 6 |
|
| 7 |
-
file_path = '/data/test_output.json'
|
| 8 |
-
|
| 9 |
-
if os.path.exists(file_path):
|
| 10 |
-
# Delete the file
|
| 11 |
-
os.remove(file_path)
|
| 12 |
-
st.write(f"The file {file_path} has been deleted.")
|
| 13 |
-
else:
|
| 14 |
-
st.write(f"The file {file_path} does not exist.")
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
# get all saved files
|
| 20 |
directory_path = '/data/'
|
| 21 |
saved_files = []
|
|
@@ -27,14 +15,25 @@ for root, dirs, files in os.walk(directory_path):
|
|
| 27 |
recipe_json = json.load(f)
|
| 28 |
saved_files.append(recipe_json)
|
| 29 |
|
| 30 |
-
st.json(saved_files)
|
| 31 |
|
| 32 |
for recipe in saved_files:
|
| 33 |
with st.expander(recipe['name']):
|
| 34 |
st.markdown(recipe['md'])
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
| 37 |
# f = open('/data/test_output.json')
|
| 38 |
# json_test = json.load(f)
|
| 39 |
|
| 40 |
-
# st.json(json_test)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
st.title("Saved Recipes")
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# get all saved files
|
| 8 |
directory_path = '/data/'
|
| 9 |
saved_files = []
|
|
|
|
| 15 |
recipe_json = json.load(f)
|
| 16 |
saved_files.append(recipe_json)
|
| 17 |
|
| 18 |
+
#st.json(saved_files)
|
| 19 |
|
| 20 |
for recipe in saved_files:
|
| 21 |
with st.expander(recipe['name']):
|
| 22 |
st.markdown(recipe['md'])
|
| 23 |
|
| 24 |
|
| 25 |
+
# ignore
|
| 26 |
+
|
| 27 |
# f = open('/data/test_output.json')
|
| 28 |
# json_test = json.load(f)
|
| 29 |
|
| 30 |
+
# st.json(json_test)
|
| 31 |
+
|
| 32 |
+
# file_path = '/data/test_output.json'
|
| 33 |
+
|
| 34 |
+
# if os.path.exists(file_path):
|
| 35 |
+
# # Delete the file
|
| 36 |
+
# os.remove(file_path)
|
| 37 |
+
# st.write(f"The file {file_path} has been deleted.")
|
| 38 |
+
# else:
|
| 39 |
+
# st.write(f"The file {file_path} does not exist.")
|