Spaces:
Running
on
Zero
Running
on
Zero
add input text clean
Browse files
app.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import re
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from tqdm.auto import tqdm
|
| 4 |
from transformers import pipeline
|
|
@@ -62,7 +64,7 @@ def correct_text(text: str, checker, corrector, separator: str = " ") -> str:
|
|
| 62 |
return corrected_text
|
| 63 |
|
| 64 |
def update(text: str):
|
| 65 |
-
text = text[:4000]
|
| 66 |
return correct_text(text, checker, corrector)
|
| 67 |
|
| 68 |
with gr.Blocks() as demo:
|
|
|
|
| 1 |
import re
|
| 2 |
+
|
| 3 |
+
from cleantext import clean
|
| 4 |
import gradio as gr
|
| 5 |
from tqdm.auto import tqdm
|
| 6 |
from transformers import pipeline
|
|
|
|
| 64 |
return corrected_text
|
| 65 |
|
| 66 |
def update(text: str):
|
| 67 |
+
text = clean(text[:4000], lower=False)
|
| 68 |
return correct_text(text, checker, corrector)
|
| 69 |
|
| 70 |
with gr.Blocks() as demo:
|