Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,9 @@ def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,r
|
|
| 63 |
if history:
|
| 64 |
hist_len=len(history)
|
| 65 |
print(hist_len)
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
yield [(prompt,"Wait. I need to compress our Chat history...")]
|
| 68 |
history=compress_history(history,client_choice,seed,temp,tokens,top_p,rep_p)
|
| 69 |
yield [(prompt,"History has been compressed, processing request...")]
|
|
@@ -78,6 +80,10 @@ def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,r
|
|
| 78 |
)
|
| 79 |
#formatted_prompt=prompt
|
| 80 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 82 |
output = ""
|
| 83 |
|
|
|
|
| 63 |
if history:
|
| 64 |
hist_len=len(history)
|
| 65 |
print(hist_len)
|
| 66 |
+
in_len=len(system_prompt+prompt)+hist_len
|
| 67 |
+
print(in_len)
|
| 68 |
+
if (in_len+tokens) > 8000:
|
| 69 |
yield [(prompt,"Wait. I need to compress our Chat history...")]
|
| 70 |
history=compress_history(history,client_choice,seed,temp,tokens,top_p,rep_p)
|
| 71 |
yield [(prompt,"History has been compressed, processing request...")]
|
|
|
|
| 80 |
)
|
| 81 |
#formatted_prompt=prompt
|
| 82 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 88 |
output = ""
|
| 89 |
|