adrianpierce commited on
Commit
2363d0e
·
1 Parent(s): e24f406

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -69,25 +69,25 @@ user_inputs = {
69
 
70
 
71
  def generate_recipe(user_inputs):
72
- with st.spinner('Building the perfect recipe for you...'):
73
- context = """Provide me a recipe based on the user input.
74
- Output this in a valid JSON object with the following properties:
75
- recipe_name (string): the name of the 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
79
- recipe_instructions (string): python list of instructions to make the recipe
80
- """
81
- messages = [
82
- {"role": "system", "content": context},
83
- {"role": "user", "content": str(user_inputs)}
84
- ]
85
-
86
- st.session_state.gpt_response = openai.ChatCompletion.create(
87
- model="gpt-3.5-turbo",
88
- messages=messages,
89
- temperature=0.5
90
- )
91
 
92
 
93
  st.button(label='Submit', on_click=generate_recipe, kwargs=dict(user_inputs=user_inputs))
 
69
 
70
 
71
  def generate_recipe(user_inputs):
72
+ #with st.spinner('Building the perfect recipe for you...'):
73
+ context = """Provide me a recipe based on the user input.
74
+ Output this in a valid JSON object with the following properties:
75
+ recipe_name (string): the name of the 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
79
+ recipe_instructions (string): python list of instructions to make the recipe
80
+ """
81
+ messages = [
82
+ {"role": "system", "content": context},
83
+ {"role": "user", "content": str(user_inputs)}
84
+ ]
85
+ st.write(messages[1])
86
+ st.session_state.gpt_response = openai.ChatCompletion.create(
87
+ model="gpt-3.5-turbo",
88
+ messages=messages,
89
+ temperature=0.5
90
+ )
91
 
92
 
93
  st.button(label='Submit', on_click=generate_recipe, kwargs=dict(user_inputs=user_inputs))