acecalisto3 commited on
Commit
18664ee
·
verified ·
1 Parent(s): 7b4d80a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -19
app.py CHANGED
@@ -8,7 +8,6 @@ from i_search import google
8
  from i_search import i_search as i_s
9
  from datetime import datetime
10
  import logging
11
- import time
12
 
13
  now = datetime.now()
14
  date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
@@ -460,24 +459,18 @@ def chat_app_logic(message, history, purpose, agent_name, sys_prompt, temperatur
460
  """
461
  if message:
462
  # Run the model and get the response (convert generator to string)
463
- for attempt in range(3): # Retry up to 3 times
464
- try:
465
- response = ''.join(generate(
466
- prompt=message,
467
- history=history,
468
- agent_name=agent_name,
469
- sys_prompt=sys_prompt,
470
- temperature=temperature,
471
- max_new_tokens=max_new_tokens,
472
- top_p=top_p,
473
- repetition_penalty=repetition_penalty,
474
- ))
475
- history.append((message, response))
476
- return history
477
- except huggingface_hub.errors.OverloadedError:
478
- logging.warning(f"Model overloaded. Retrying in {attempt + 1} seconds...")
479
- time.sleep(attempt + 1) # Wait a bit longer each time
480
- return history # If all attempts fail, return the history without a response
481
 
482
  return history
483
 
 
8
  from i_search import i_search as i_s
9
  from datetime import datetime
10
  import logging
 
11
 
12
  now = datetime.now()
13
  date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
 
459
  """
460
  if message:
461
  # Run the model and get the response (convert generator to string)
462
+ response = ''.join(generate(
463
+ prompt=message,
464
+ history=history,
465
+ agent_name=agent_name,
466
+ sys_prompt=sys_prompt,
467
+ temperature=temperature,
468
+ max_new_tokens=max_new_tokens,
469
+ top_p=top_p,
470
+ repetition_penalty=repetition_penalty,
471
+ ))
472
+ history.append((message, response))
473
+ return history
 
 
 
 
 
 
474
 
475
  return history
476