Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
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 |
|