otro modelo para probar
Browse files- appCorrectorEscritura.py +7 -8
appCorrectorEscritura.py
CHANGED
|
@@ -7,20 +7,19 @@ Pipeline de text2text-generation con un modelo finetuneado para corrección en e
|
|
| 7 |
import gradio as gr
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
-
|
| 11 |
-
corrector = pipeline("text2text-generation", model="google/mt5-small")
|
| 12 |
|
| 13 |
def corregir_texto(texto):
|
| 14 |
-
prompt = f"
|
| 15 |
-
resultado = corrector(prompt, max_new_tokens=
|
| 16 |
return resultado
|
| 17 |
|
| 18 |
iface = gr.Interface(
|
| 19 |
fn=corregir_texto,
|
| 20 |
-
inputs=gr.Textbox(lines=6, placeholder="
|
| 21 |
-
outputs=gr.Textbox(label="
|
| 22 |
-
title="
|
| 23 |
-
description="
|
| 24 |
)
|
| 25 |
|
| 26 |
iface.launch()
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
+
corrector = pipeline("text2text-generation", model="vennify/t5-base-grammar-correction")
|
|
|
|
| 11 |
|
| 12 |
def corregir_texto(texto):
|
| 13 |
+
prompt = f"correct: {texto}"
|
| 14 |
+
resultado = corrector(prompt, max_new_tokens=100)[0]['generated_text']
|
| 15 |
return resultado
|
| 16 |
|
| 17 |
iface = gr.Interface(
|
| 18 |
fn=corregir_texto,
|
| 19 |
+
inputs=gr.Textbox(lines=6, placeholder="Type your text with errors..."),
|
| 20 |
+
outputs=gr.Textbox(label="Corrected Text"),
|
| 21 |
+
title="English Grammar Corrector",
|
| 22 |
+
description="Corrects spelling and grammar in English. Simple and lightweight."
|
| 23 |
)
|
| 24 |
|
| 25 |
iface.launch()
|