Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,12 +56,14 @@ def format_prompt(message, history):
|
|
| 56 |
|
| 57 |
def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,rep_p):
|
| 58 |
#token max=8192
|
|
|
|
| 59 |
client=clients[int(client_choice)-1]
|
| 60 |
if not history:
|
| 61 |
history = []
|
| 62 |
hist_len=0
|
| 63 |
if history:
|
| 64 |
-
|
|
|
|
| 65 |
print(hist_len)
|
| 66 |
in_len=len(system_prompt+prompt)+hist_len
|
| 67 |
print("\n######### HIST "+str(in_len))
|
|
@@ -81,7 +83,7 @@ def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,r
|
|
| 81 |
)
|
| 82 |
#formatted_prompt=prompt
|
| 83 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
| 84 |
-
print("\n######### PROMPT "+str(len(formatted_prompt
|
| 85 |
|
| 86 |
|
| 87 |
|
|
|
|
| 56 |
|
| 57 |
def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,rep_p):
|
| 58 |
#token max=8192
|
| 59 |
+
hist_len=0
|
| 60 |
client=clients[int(client_choice)-1]
|
| 61 |
if not history:
|
| 62 |
history = []
|
| 63 |
hist_len=0
|
| 64 |
if history:
|
| 65 |
+
for ea in history:
|
| 66 |
+
hist_len+=len(str(ea))
|
| 67 |
print(hist_len)
|
| 68 |
in_len=len(system_prompt+prompt)+hist_len
|
| 69 |
print("\n######### HIST "+str(in_len))
|
|
|
|
| 83 |
)
|
| 84 |
#formatted_prompt=prompt
|
| 85 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
| 86 |
+
print("\n######### PROMPT "+str(len(formatted_prompt)))
|
| 87 |
|
| 88 |
|
| 89 |
|