wop commited on
Commit
0f9e51d
·
verified ·
1 Parent(s): f213f73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -49,8 +49,10 @@ def generate(prompt, system, history, temperature=0.9, max_new_tokens=4096, top_
49
  response_text = response.split("ASSISTANT:")[-1].strip()
50
 
51
  # Simulate streaming by yielding parts of the response
 
52
  for char in response_text:
53
- yield char
 
54
  time.sleep(0.05) # Add a slight delay to simulate typing
55
 
56
  # Save the generated response to the database after the response is generated
 
49
  response_text = response.split("ASSISTANT:")[-1].strip()
50
 
51
  # Simulate streaming by yielding parts of the response
52
+ accumulated_response = "" # To keep track of the full response
53
  for char in response_text:
54
+ accumulated_response += char # Append the new character
55
+ yield accumulated_response # Yield the accumulated response
56
  time.sleep(0.05) # Add a slight delay to simulate typing
57
 
58
  # Save the generated response to the database after the response is generated