Spaces:
Runtime error
Runtime error
Commit
·
4691041
1
Parent(s):
30d2389
Update app.py
Browse files
app.py
CHANGED
@@ -72,8 +72,7 @@ def generate_recipe(user_inputs):
|
|
72 |
#with st.spinner('Building the perfect recipe for you...'):
|
73 |
context = """You are an expert chef assistant that can make a wide variety of recipes based on user input.
|
74 |
Output a recipe in a valid JSON object with the following properties:
|
75 |
-
recipe_name (string): provide a name for the generated recipe
|
76 |
-
recipe_description (string): a brief description of the recipe itself, the contents and/or instructions, 3 sentences maximum
|
77 |
recipe_serving_size (string): the serving size of the recipe (example: "4 people")
|
78 |
recipe_time (string): the amount of time required to make the recipe (example: "60 minutes (Preparation: 20 minutes, Baking: 40 minutes)")
|
79 |
recipe_ingredients (string): python list of ingredients required to make the recipe
|
@@ -83,11 +82,10 @@ def generate_recipe(user_inputs):
|
|
83 |
{"role": "system", "content": context},
|
84 |
{"role": "user", "content": f'user_input={str(user_inputs)}'}
|
85 |
]
|
86 |
-
st.write(messages[1])
|
87 |
st.session_state.gpt_response = openai.ChatCompletion.create(
|
88 |
model="gpt-4",
|
89 |
messages=messages,
|
90 |
-
temperature=
|
91 |
)
|
92 |
|
93 |
|
@@ -97,7 +95,6 @@ if st.session_state.gpt_response is not None:
|
|
97 |
st.divider()
|
98 |
loaded_recipe = json.loads(st.session_state.gpt_response['choices'][0]['message']['content'])
|
99 |
st.header(loaded_recipe['recipe_name'])
|
100 |
-
st.write(loaded_recipe['recipe_description'])
|
101 |
st.write(f"**Serving Size: {loaded_recipe['recipe_serving_size']}**")
|
102 |
st.write(f"**Time To Make: {loaded_recipe['recipe_time']}**")
|
103 |
st.subheader("Ingredients:")
|
|
|
72 |
#with st.spinner('Building the perfect recipe for you...'):
|
73 |
context = """You are an expert chef assistant that can make a wide variety of recipes based on user input.
|
74 |
Output a recipe in a valid JSON object with the following properties:
|
75 |
+
recipe_name (string): provide a name for the generated recipe
|
|
|
76 |
recipe_serving_size (string): the serving size of the recipe (example: "4 people")
|
77 |
recipe_time (string): the amount of time required to make the recipe (example: "60 minutes (Preparation: 20 minutes, Baking: 40 minutes)")
|
78 |
recipe_ingredients (string): python list of ingredients required to make the recipe
|
|
|
82 |
{"role": "system", "content": context},
|
83 |
{"role": "user", "content": f'user_input={str(user_inputs)}'}
|
84 |
]
|
|
|
85 |
st.session_state.gpt_response = openai.ChatCompletion.create(
|
86 |
model="gpt-4",
|
87 |
messages=messages,
|
88 |
+
temperature=1
|
89 |
)
|
90 |
|
91 |
|
|
|
95 |
st.divider()
|
96 |
loaded_recipe = json.loads(st.session_state.gpt_response['choices'][0]['message']['content'])
|
97 |
st.header(loaded_recipe['recipe_name'])
|
|
|
98 |
st.write(f"**Serving Size: {loaded_recipe['recipe_serving_size']}**")
|
99 |
st.write(f"**Time To Make: {loaded_recipe['recipe_time']}**")
|
100 |
st.subheader("Ingredients:")
|