Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -16,10 +16,10 @@ if "model" not in globals():
|
|
16 |
# Funci贸n exclusiva para humanizaci贸n de texto con enfoque en marketing
|
17 |
def humanize_text(input_text):
|
18 |
system_prompt = (
|
19 |
-
"Reescribe el siguiente texto
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
)
|
24 |
|
25 |
prompt = f"{system_prompt}\n\nTexto original: {input_text}\n\nTexto humanizado:"
|
@@ -29,12 +29,12 @@ def humanize_text(input_text):
|
|
29 |
outputs = model.generate(
|
30 |
inputs.input_ids,
|
31 |
attention_mask=inputs.attention_mask,
|
32 |
-
max_new_tokens=
|
33 |
-
min_length=
|
34 |
-
do_sample=
|
35 |
-
temperature=0.
|
36 |
top_p=0.9, # 馃敼 Mantiene coherencia en la reescritura
|
37 |
-
repetition_penalty=1.
|
38 |
num_return_sequences=1, # 馃敼 Genera solo una respuesta bien formulada
|
39 |
)
|
40 |
|
@@ -42,7 +42,7 @@ def humanize_text(input_text):
|
|
42 |
|
43 |
# Interfaz en Gradio
|
44 |
with gr.Blocks() as demo:
|
45 |
-
gr.Markdown("# 鉁嶏笍 Humanizaci贸n de Texto con ALIA (
|
46 |
input_text = gr.Textbox(label="Pega aqu铆 el texto generado por IA para humanizar")
|
47 |
output_text = gr.Textbox(label="Texto humanizado por ALIA", interactive=False)
|
48 |
submit_button = gr.Button("Humanizar Texto")
|
|
|
16 |
# Funci贸n exclusiva para humanizaci贸n de texto con enfoque en marketing
|
17 |
def humanize_text(input_text):
|
18 |
system_prompt = (
|
19 |
+
"Reescribe el siguiente texto con un tono claro, natural y persuasivo, "
|
20 |
+
"haci茅ndolo m谩s cercano y atractivo para el lector. "
|
21 |
+
"Evita estructuras rob贸ticas y haz que fluya de manera m谩s org谩nica. "
|
22 |
+
"No cambies el significado ni elimines informaci贸n importante."
|
23 |
)
|
24 |
|
25 |
prompt = f"{system_prompt}\n\nTexto original: {input_text}\n\nTexto humanizado:"
|
|
|
29 |
outputs = model.generate(
|
30 |
inputs.input_ids,
|
31 |
attention_mask=inputs.attention_mask,
|
32 |
+
max_new_tokens=120, # 馃敼 Reduce la generaci贸n excesiva de texto
|
33 |
+
min_length=50, # 馃敼 Mantiene respuestas completas pero sin excesos
|
34 |
+
do_sample=False, # 馃敼 Desactiva muestreo para respuestas m谩s r谩pidas
|
35 |
+
temperature=0.7, # 馃敼 Menos procesamiento interno, mantiene calidad
|
36 |
top_p=0.9, # 馃敼 Mantiene coherencia en la reescritura
|
37 |
+
repetition_penalty=1.02, # 馃敼 Reduce repeticiones sin limitar la fluidez
|
38 |
num_return_sequences=1, # 馃敼 Genera solo una respuesta bien formulada
|
39 |
)
|
40 |
|
|
|
42 |
|
43 |
# Interfaz en Gradio
|
44 |
with gr.Blocks() as demo:
|
45 |
+
gr.Markdown("# 鉁嶏笍 Humanizaci贸n de Texto con ALIA (Optimizaci贸n de Velocidad)")
|
46 |
input_text = gr.Textbox(label="Pega aqu铆 el texto generado por IA para humanizar")
|
47 |
output_text = gr.Textbox(label="Texto humanizado por ALIA", interactive=False)
|
48 |
submit_button = gr.Button("Humanizar Texto")
|