beryamosta commited on
Commit
bb94458
·
verified ·
1 Parent(s): 7c9b01e

Update backend.py

Browse files
Files changed (1) hide show
  1. backend.py +8 -3
backend.py CHANGED
@@ -253,8 +253,13 @@ def prompt_objectif(user_input):
253
 
254
  # Extract and return the generated response
255
  resultat = response.choices[0].message.content
256
- return resultat
 
 
257
 
258
  except Exception as e:
259
- print(f"Failed to generate questions: {e}")
260
- return None
 
 
 
 
253
 
254
  # Extract and return the generated response
255
  resultat = response.choices[0].message.content
256
+ for word in resultat.split():
257
+ yield word + " "
258
+ time.sleep(0.05)
259
 
260
  except Exception as e:
261
+ message_error = f"Failed to generate questions: {e}"
262
+ for word in message_error.split():
263
+ yield word + " "
264
+ time.sleep(0.05)
265
+