Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,12 +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 de
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"pero sin perder profesionalismo ni precisi贸n. "
|
| 24 |
-
"Evita repeticiones, burocracia y cualquier tipo de formalismo innecesario."
|
| 25 |
)
|
| 26 |
|
| 27 |
prompt = f"{system_prompt}\n\nTexto original: {input_text}\n\nTexto humanizado:"
|
|
@@ -31,12 +29,12 @@ def humanize_text(input_text):
|
|
| 31 |
outputs = model.generate(
|
| 32 |
inputs.input_ids,
|
| 33 |
attention_mask=inputs.attention_mask,
|
| 34 |
-
max_new_tokens=
|
| 35 |
min_length=30, # 馃敼 Evita respuestas demasiado cortas
|
| 36 |
do_sample=True, # 馃敼 Mantiene variabilidad en la reescritura
|
| 37 |
-
temperature=0.
|
| 38 |
top_p=0.9, # 馃敼 Mantiene coherencia en la reescritura
|
| 39 |
-
repetition_penalty=1.
|
| 40 |
num_return_sequences=1, # 馃敼 Genera solo una respuesta bien formulada
|
| 41 |
)
|
| 42 |
|
|
@@ -44,7 +42,7 @@ def humanize_text(input_text):
|
|
| 44 |
|
| 45 |
# Interfaz en Gradio
|
| 46 |
with gr.Blocks() as demo:
|
| 47 |
-
gr.Markdown("# 鉁嶏笍 Humanizaci贸n de Texto con ALIA (
|
| 48 |
input_text = gr.Textbox(label="Pega aqu铆 el texto generado por IA para humanizar")
|
| 49 |
output_text = gr.Textbox(label="Texto humanizado por ALIA", interactive=False)
|
| 50 |
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 de manera m谩s natural, clara y persuasiva, "
|
| 20 |
+
"sin perder informaci贸n clave. Mant茅n un tono conversacional y cercano, "
|
| 21 |
+
"como si estuvieras explic谩ndolo de forma sencilla a alguien sin conocimiento t茅cnico. "
|
| 22 |
+
"Evita frases burocr谩ticas y hazlo m谩s f谩cil de leer."
|
|
|
|
|
|
|
| 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=150, # 馃敼 Equilibrio entre reformulaci贸n y velocidad
|
| 33 |
min_length=30, # 馃敼 Evita respuestas demasiado cortas
|
| 34 |
do_sample=True, # 馃敼 Mantiene variabilidad en la reescritura
|
| 35 |
+
temperature=0.75, # 馃敼 Balance entre creatividad y precisi贸n
|
| 36 |
top_p=0.9, # 馃敼 Mantiene coherencia en la reescritura
|
| 37 |
+
repetition_penalty=1.05, # 馃敼 Evita repeticiones sin restringir demasiado
|
| 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 (Versi贸n m谩s estable)")
|
| 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")
|