Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,12 +43,13 @@ def format_prompt(message, history, cust_p):
|
|
| 43 |
|
| 44 |
def chat_inf(system_prompt,prompt,history,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,cust_p,translate_fa):
|
| 45 |
#token max=8192
|
| 46 |
-
if(
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
print(client_choice)
|
| 53 |
hist_len=0
|
| 54 |
client=clients[int(client_choice)-1]
|
|
|
|
| 43 |
|
| 44 |
def chat_inf(system_prompt,prompt,history,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,cust_p,translate_fa):
|
| 45 |
#token max=8192
|
| 46 |
+
if(translate_fa == True):
|
| 47 |
+
if(len(prompt) > 2000):
|
| 48 |
+
translatedtext1 = GoogleTranslator(source='auto', target='en').translate(prompt[0:2000])
|
| 49 |
+
translatedtext2 = GoogleTranslator(source='auto', target='en').translate(prompt[2000:(len(prompt))])
|
| 50 |
+
prompt = translatedtext1 + translatedtext2
|
| 51 |
+
else:
|
| 52 |
+
prompt = GoogleTranslator(source='auto', target='en').translate(prompt)
|
| 53 |
print(client_choice)
|
| 54 |
hist_len=0
|
| 55 |
client=clients[int(client_choice)-1]
|