Spaces:
Sleeping
Sleeping
Commit
·
7ca3025
1
Parent(s):
d0c372a
Update app.py
Browse files
app.py
CHANGED
@@ -107,12 +107,36 @@ def generate_recipe(user_inputs):
|
|
107 |
"description": "a brief one sentence description of the provided recipe"
|
108 |
},
|
109 |
"ingredients": {
|
110 |
-
"type": "
|
111 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
},
|
113 |
"instructions": {
|
114 |
-
"type": "
|
115 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
},
|
118 |
"required": [
|
@@ -147,16 +171,16 @@ if st.session_state.gpt_response is not None:
|
|
147 |
st.subheader("Ingredients:")
|
148 |
try:
|
149 |
md_ingredients = ''
|
150 |
-
for ingredient in loaded_recipe['ingredients']
|
151 |
-
md_ingredients += "-
|
152 |
st.markdown(md_ingredients)
|
153 |
except:
|
154 |
st.write(loaded_recipe['ingredients'])
|
155 |
st.subheader("Instructions:")
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
107 |
"description": "a brief one sentence description of the provided recipe"
|
108 |
},
|
109 |
"ingredients": {
|
110 |
+
"type": "array",
|
111 |
+
"items": {
|
112 |
+
"type": "object",
|
113 |
+
"properties": {
|
114 |
+
"name": {
|
115 |
+
"type": "string",
|
116 |
+
"description": "Name of the ingredient"
|
117 |
+
},
|
118 |
+
"quantity": {
|
119 |
+
"type": "string",
|
120 |
+
"description": "Amount of the ingredient"
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
},
|
125 |
"instructions": {
|
126 |
+
"type": "array",
|
127 |
+
"items": {
|
128 |
+
"type": "object",
|
129 |
+
"properties": {
|
130 |
+
"step_number": {
|
131 |
+
"type": "number",
|
132 |
+
"description": "The sequence number of this step"
|
133 |
+
},
|
134 |
+
"instruction": {
|
135 |
+
"type": "string",
|
136 |
+
"description": "Detailed description of what to do in this step"
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
}
|
141 |
},
|
142 |
"required": [
|
|
|
171 |
st.subheader("Ingredients:")
|
172 |
try:
|
173 |
md_ingredients = ''
|
174 |
+
for ingredient in loaded_recipe['ingredients']:
|
175 |
+
md_ingredients += f"- {ingredient['quantity']} {ingredient['name']} \n"
|
176 |
st.markdown(md_ingredients)
|
177 |
except:
|
178 |
st.write(loaded_recipe['ingredients'])
|
179 |
st.subheader("Instructions:")
|
180 |
+
try:
|
181 |
+
md_instructions = ''
|
182 |
+
for instruction in recipe['instructions']:
|
183 |
+
md_instructions += f"{instruction['step_number']}. {instruction['instruction']} \n"
|
184 |
+
st.markdown(md_instructions)
|
185 |
+
except:
|
186 |
+
st.write(loaded_recipe['instructions'])
|