Luigi commited on
Commit
35943b1
·
1 Parent(s): c9fd924

reset timeout timer once a new token is generated

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -275,6 +275,8 @@ if user_input:
275
  visible_response = re.sub(r"<think>.*?</think>", "", final_response, flags=re.DOTALL)
276
  visible_response = re.sub(r"<think>.*$", "", visible_response, flags=re.DOTALL)
277
  visible_placeholder.markdown(visible_response)
 
 
278
  except queue.Empty:
279
  if time.time() - start_time > timeout:
280
  st.error("Response generation timed out.")
 
275
  visible_response = re.sub(r"<think>.*?</think>", "", final_response, flags=re.DOTALL)
276
  visible_response = re.sub(r"<think>.*$", "", visible_response, flags=re.DOTALL)
277
  visible_placeholder.markdown(visible_response)
278
+ # Reset the timer after each token is generated
279
+ start_time = time.time()
280
  except queue.Empty:
281
  if time.time() - start_time > timeout:
282
  st.error("Response generation timed out.")