3v324v23 commited on
Commit
c59f12a
·
1 Parent(s): 1c11924

Fix: use chat_completion instead of text_generation

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -27,12 +27,13 @@ if st.button("Generate Recipe"):
27
  f"- Numbered step-by-step cooking instructions\n"
28
  f"- Estimated cooking time\n"
29
  )
30
- response = client.text_generation(
31
- prompt,
32
  model="mistralai/Mistral-7B-Instruct-v0.3",
33
- max_new_tokens=400,
 
34
  temperature=0.7,
35
  )
36
- st.success(response)
 
37
  else:
38
  st.warning("Please enter some ingredients!")
 
27
  f"- Numbered step-by-step cooking instructions\n"
28
  f"- Estimated cooking time\n"
29
  )
30
+ response = client.chat_completion(
 
31
  model="mistralai/Mistral-7B-Instruct-v0.3",
32
+ messages=[{"role": "user", "content": prompt}],
33
+ max_tokens=400,
34
  temperature=0.7,
35
  )
36
+ recipe = response.choices[0].message.content
37
+ st.success(recipe)
38
  else:
39
  st.warning("Please enter some ingredients!")