Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def text_prompt(request, page_url, contraseña, temp):
|
|
34 |
# Recortar el texto a un máximo de 1800 tokens
|
35 |
if len(tokens) > 1800:
|
36 |
break
|
37 |
-
page_text += sentence + " "
|
38 |
|
39 |
# Eliminar el ultimo espacio
|
40 |
page_text = page_text.strip()
|
@@ -58,6 +58,7 @@ def text_prompt(request, page_url, contraseña, temp):
|
|
58 |
|
59 |
# clean the response text
|
60 |
response_text = re.sub(r'\s+', ' ', response_text)
|
|
|
61 |
return page.text, response_text, total_tokens
|
62 |
except Exception as e:
|
63 |
return page.text, f"--- Ha ocurrido un error al procesar la solicitud: {e} ---", num_tokens
|
|
|
34 |
# Recortar el texto a un máximo de 1800 tokens
|
35 |
if len(tokens) > 1800:
|
36 |
break
|
37 |
+
page_text += sentence + ". "
|
38 |
|
39 |
# Eliminar el ultimo espacio
|
40 |
page_text = page_text.strip()
|
|
|
58 |
|
59 |
# clean the response text
|
60 |
response_text = re.sub(r'\s+', ' ', response_text)
|
61 |
+
response_text = response_text.strip()
|
62 |
return page.text, response_text, total_tokens
|
63 |
except Exception as e:
|
64 |
return page.text, f"--- Ha ocurrido un error al procesar la solicitud: {e} ---", num_tokens
|