Spaces:
Running
on
Zero
Running
on
Zero
Ayushnangia
commited on
Commit
•
b962691
1
Parent(s):
6ec4d4f
trying fixing error
Browse files
app.py
CHANGED
@@ -2,19 +2,22 @@ import os
|
|
2 |
import spaces
|
3 |
|
4 |
import nltk
|
5 |
-
nltk.download('punkt')
|
6 |
from doctr.io import DocumentFile
|
7 |
from doctr.models import ocr_predictor
|
8 |
import gradio as gr
|
9 |
from PIL import Image
|
10 |
from happytransformer import HappyTextToText, TTSettings
|
11 |
-
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
12 |
import re
|
13 |
from lang_list import (
|
14 |
LANGUAGE_NAME_TO_CODE,
|
15 |
T2TT_TARGET_LANGUAGE_NAMES,
|
16 |
TEXT_SOURCE_LANGUAGE_NAMES,
|
17 |
)
|
|
|
|
|
18 |
DEFAULT_TARGET_LANGUAGE = "English"
|
19 |
from transformers import SeamlessM4TForTextToText
|
20 |
from transformers import AutoProcessor
|
@@ -34,7 +37,7 @@ OCRmodel = AutoModelForSeq2SeqLM.from_pretrained("Bhuvana/t5-base-spellchecker")
|
|
34 |
|
35 |
|
36 |
def correct_spell(inputs):
|
37 |
-
input_ids = OCRtokenizer.encode(inputs, return_tensors='pt'
|
38 |
sample_output = OCRmodel.generate(
|
39 |
input_ids,
|
40 |
do_sample=True,
|
|
|
2 |
import spaces
|
3 |
|
4 |
import nltk
|
5 |
+
nltk.download('punkt',quiet=True)
|
6 |
from doctr.io import DocumentFile
|
7 |
from doctr.models import ocr_predictor
|
8 |
import gradio as gr
|
9 |
from PIL import Image
|
10 |
from happytransformer import HappyTextToText, TTSettings
|
11 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM,logging
|
12 |
+
from transformers.integrations import deepspeed
|
13 |
import re
|
14 |
from lang_list import (
|
15 |
LANGUAGE_NAME_TO_CODE,
|
16 |
T2TT_TARGET_LANGUAGE_NAMES,
|
17 |
TEXT_SOURCE_LANGUAGE_NAMES,
|
18 |
)
|
19 |
+
logging.set_verbosity_error()
|
20 |
+
|
21 |
DEFAULT_TARGET_LANGUAGE = "English"
|
22 |
from transformers import SeamlessM4TForTextToText
|
23 |
from transformers import AutoProcessor
|
|
|
37 |
|
38 |
|
39 |
def correct_spell(inputs):
|
40 |
+
input_ids = OCRtokenizer.encode(inputs, return_tensors='pt')
|
41 |
sample_output = OCRmodel.generate(
|
42 |
input_ids,
|
43 |
do_sample=True,
|