Spaces:
Runtime error
Runtime error
Commit ·
e83ee50
0
Parent(s):
Duplicate from Omnibus/detect-language
Browse files- .gitattributes +35 -0
- README.md +12 -0
- app.py +742 -0
- requirements.txt +1 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Detect Language
|
| 3 |
+
emoji: 🌍
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.42.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
duplicated_from: Omnibus/detect-language
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,742 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import easyocr
|
| 3 |
+
import numpy as np
|
| 4 |
+
from PIL import Image
|
| 5 |
+
import uuid
|
| 6 |
+
import random
|
| 7 |
+
import time
|
| 8 |
+
|
| 9 |
+
uid=uuid.uuid4()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
ocr_id = {
|
| 13 |
+
"Afrikaans": "af",
|
| 14 |
+
"Albanian": "sq",
|
| 15 |
+
"Arabic": "ar",
|
| 16 |
+
"Azerbaijani": "az",
|
| 17 |
+
"Belarusian": "be",
|
| 18 |
+
"Bulgarian": "bg",
|
| 19 |
+
"Bengali": "bn",
|
| 20 |
+
"Bosnian": "bs",
|
| 21 |
+
"Chinese (simplified)": "ch_sim",
|
| 22 |
+
"Chinese (traditional)": "ch_tra",
|
| 23 |
+
"Croatian": "hr",
|
| 24 |
+
"Czech": "cs",
|
| 25 |
+
"Danish": "da",
|
| 26 |
+
"Dutch": "nl",
|
| 27 |
+
"English": "en",
|
| 28 |
+
"Estonian": "et",
|
| 29 |
+
"French": "fr",
|
| 30 |
+
"German": "de",
|
| 31 |
+
"Irish": "ga",
|
| 32 |
+
"Hindi": "hi",
|
| 33 |
+
"Hungarian": "hu",
|
| 34 |
+
"Indonesian": "id",
|
| 35 |
+
"Icelandic": "is",
|
| 36 |
+
"Italian": "it",
|
| 37 |
+
"Japanese": "ja",
|
| 38 |
+
"Kannada": "kn",
|
| 39 |
+
"Korean": "ko",
|
| 40 |
+
"Lithuanian": "lt",
|
| 41 |
+
"Latvian": "lv",
|
| 42 |
+
"Mongolian": "mn",
|
| 43 |
+
"Marathi": "mr",
|
| 44 |
+
"Malay": "ms",
|
| 45 |
+
"Nepali": "ne",
|
| 46 |
+
"Norwegian": "no",
|
| 47 |
+
"Occitan": "oc",
|
| 48 |
+
"Polish": "pl",
|
| 49 |
+
"Portuguese": "pt",
|
| 50 |
+
"Romanian": "ro",
|
| 51 |
+
"Russian": "ru",
|
| 52 |
+
"Serbian (cyrillic)": "rs_cyrillic",
|
| 53 |
+
"Serbian (latin)": "rs_latin",
|
| 54 |
+
"Slovak": "sk",
|
| 55 |
+
"Slovenian": "sl",
|
| 56 |
+
"Spanish": "es",
|
| 57 |
+
"Swedish": "sv",
|
| 58 |
+
"Swahili": "sw",
|
| 59 |
+
"Tamil": "ta",
|
| 60 |
+
"Thai": "th",
|
| 61 |
+
"Tagalog": "tl",
|
| 62 |
+
"Turkish": "tr",
|
| 63 |
+
"Ukrainian": "uk",
|
| 64 |
+
"Urdu": "ur",
|
| 65 |
+
"Uzbek": "uz",
|
| 66 |
+
"Vietnamese": "vi",
|
| 67 |
+
"Welsh": "cy",
|
| 68 |
+
"Zulu": "zu",
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
model1 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 72 |
+
model2 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 73 |
+
model3 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 74 |
+
model4 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 75 |
+
model5 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 76 |
+
model6 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 77 |
+
model7 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 78 |
+
model8 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 79 |
+
model9 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 80 |
+
model10 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 81 |
+
model11 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 82 |
+
model12 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 83 |
+
model13 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 84 |
+
model14 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 85 |
+
model15 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 86 |
+
model16 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 87 |
+
model17 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 88 |
+
model18 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 89 |
+
model19 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 90 |
+
model20 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 91 |
+
mylist = []
|
| 92 |
+
myval = []
|
| 93 |
+
for key in ocr_id.keys():
|
| 94 |
+
mylist.append(key)
|
| 95 |
+
ser_len=len(ocr_id)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def set_targ():
|
| 99 |
+
targ = 0
|
| 100 |
+
return targ
|
| 101 |
+
|
| 102 |
+
num1 = []
|
| 103 |
+
targ = []
|
| 104 |
+
targ_lang=[]
|
| 105 |
+
|
| 106 |
+
def proc0(img):
|
| 107 |
+
num1.clear()
|
| 108 |
+
num1.append(0)
|
| 109 |
+
targ.clear()
|
| 110 |
+
targ.append(0)
|
| 111 |
+
targ_lang.clear()
|
| 112 |
+
targ_lang.append(mylist[0])
|
| 113 |
+
print ("LISTS CLEARED")
|
| 114 |
+
#def main_proc()
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def proc1(img):
|
| 118 |
+
rand = random.randint(1,3000)
|
| 119 |
+
time.sleep(rand/1000)
|
| 120 |
+
new_num=len(num1)-1
|
| 121 |
+
num = new_num
|
| 122 |
+
print (f"new_num: {new_num}")
|
| 123 |
+
if int(num) <= (ser_len - 1):
|
| 124 |
+
num1.append(1)
|
| 125 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 126 |
+
print(f"lang: {lang}")
|
| 127 |
+
out = model1(img,lang)
|
| 128 |
+
print (f'bounds: {out}')
|
| 129 |
+
try:
|
| 130 |
+
if float(out) > float(targ[0]):
|
| 131 |
+
targ[0]=out
|
| 132 |
+
targ_lang[0]=mylist[int(num)]
|
| 133 |
+
else:
|
| 134 |
+
pass
|
| 135 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 136 |
+
|
| 137 |
+
except Exception as e:
|
| 138 |
+
out_a = f"Error:: {e} :: {num}"
|
| 139 |
+
else:
|
| 140 |
+
out_a = 'Done'
|
| 141 |
+
pass
|
| 142 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 143 |
+
return (out_a, out_p)
|
| 144 |
+
|
| 145 |
+
def proc2(img):
|
| 146 |
+
rand = random.randint(1,3000)
|
| 147 |
+
time.sleep(rand/1000)
|
| 148 |
+
new_num=len(num1)-1
|
| 149 |
+
num = new_num
|
| 150 |
+
print (f"new_num: {new_num}")
|
| 151 |
+
if int(num) <= (ser_len - 1):
|
| 152 |
+
num1.append(1)
|
| 153 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 154 |
+
print(f"lang: {lang}")
|
| 155 |
+
out = model2(img,lang)
|
| 156 |
+
print (f'bounds: {out}')
|
| 157 |
+
try:
|
| 158 |
+
if float(out) > float(targ[0]):
|
| 159 |
+
targ[0] = out
|
| 160 |
+
targ_lang[0]=mylist[int(num)]
|
| 161 |
+
else:
|
| 162 |
+
pass
|
| 163 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 164 |
+
except Exception as e:
|
| 165 |
+
out_a = f"Error:: {e} :: {num}"
|
| 166 |
+
else:
|
| 167 |
+
out_a = 'Done'
|
| 168 |
+
pass
|
| 169 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 170 |
+
return (out_a, out_p)
|
| 171 |
+
|
| 172 |
+
def proc3(img):
|
| 173 |
+
rand = random.randint(1,3000)
|
| 174 |
+
time.sleep(rand/1000)
|
| 175 |
+
new_num=len(num1)-1
|
| 176 |
+
num = new_num
|
| 177 |
+
print (f"new_num: {new_num}")
|
| 178 |
+
if int(num) <= (ser_len - 1):
|
| 179 |
+
num1.append(1)
|
| 180 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 181 |
+
print(f"lang: {lang}")
|
| 182 |
+
out = model3(img,lang)
|
| 183 |
+
print (f'bounds: {out}')
|
| 184 |
+
try:
|
| 185 |
+
if float(out) > float(targ[0]):
|
| 186 |
+
targ[0] = out
|
| 187 |
+
targ_lang[0]=mylist[int(num)]
|
| 188 |
+
else:
|
| 189 |
+
pass
|
| 190 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 191 |
+
|
| 192 |
+
except Exception as e:
|
| 193 |
+
out_a = f"Error:: {e} :: {num}"
|
| 194 |
+
else:
|
| 195 |
+
out_a = 'Done'
|
| 196 |
+
pass
|
| 197 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 198 |
+
return (out_a, out_p)
|
| 199 |
+
|
| 200 |
+
def proc4(img):
|
| 201 |
+
rand = random.randint(1,3000)
|
| 202 |
+
time.sleep(rand/1000)
|
| 203 |
+
new_num=len(num1)-1
|
| 204 |
+
num = new_num
|
| 205 |
+
print (f"new_num: {new_num}")
|
| 206 |
+
if int(num) <= (ser_len - 1):
|
| 207 |
+
num1.append(1)
|
| 208 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 209 |
+
print(f"lang: {lang}")
|
| 210 |
+
out = model4(img,lang)
|
| 211 |
+
print (f'bounds: {out}')
|
| 212 |
+
try:
|
| 213 |
+
if float(out) > float(targ[0]):
|
| 214 |
+
targ[0] = out
|
| 215 |
+
targ_lang[0]=mylist[int(num)]
|
| 216 |
+
else:
|
| 217 |
+
pass
|
| 218 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 219 |
+
|
| 220 |
+
except Exception as e:
|
| 221 |
+
out_a = f"Error:: {e} :: {num}"
|
| 222 |
+
else:
|
| 223 |
+
out_a = 'Done'
|
| 224 |
+
pass
|
| 225 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 226 |
+
return (out_a, out_p)
|
| 227 |
+
|
| 228 |
+
def proc5(img):
|
| 229 |
+
rand = random.randint(1,3000)
|
| 230 |
+
time.sleep(rand/1000)
|
| 231 |
+
new_num=len(num1)-1
|
| 232 |
+
num = new_num
|
| 233 |
+
print (f"new_num: {new_num}")
|
| 234 |
+
if int(num) <= (ser_len - 1):
|
| 235 |
+
num1.append(1)
|
| 236 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 237 |
+
print(f"lang: {lang}")
|
| 238 |
+
out = model5(img,lang)
|
| 239 |
+
print (f'bounds: {out}')
|
| 240 |
+
try:
|
| 241 |
+
if float(out) > float(targ[0]):
|
| 242 |
+
targ[0] = out
|
| 243 |
+
targ_lang[0]=mylist[int(num)]
|
| 244 |
+
else:
|
| 245 |
+
pass
|
| 246 |
+
except Exception as e:
|
| 247 |
+
return f"Error:: {e}"
|
| 248 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 249 |
+
else:
|
| 250 |
+
out_a = 'Done'
|
| 251 |
+
pass
|
| 252 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 253 |
+
return (out_a, out_p)
|
| 254 |
+
|
| 255 |
+
def proc6(img):
|
| 256 |
+
rand = random.randint(1,3000)
|
| 257 |
+
time.sleep(rand/1000)
|
| 258 |
+
new_num=len(num1)-1
|
| 259 |
+
num = new_num
|
| 260 |
+
print (f"new_num: {new_num}")
|
| 261 |
+
if int(num) <= (ser_len - 1):
|
| 262 |
+
num1.append(1)
|
| 263 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 264 |
+
print(f"lang: {lang}")
|
| 265 |
+
out = model6(img,lang)
|
| 266 |
+
print (f'bounds: {out}')
|
| 267 |
+
try:
|
| 268 |
+
if float(out) > float(targ[0]):
|
| 269 |
+
targ[0] = out
|
| 270 |
+
targ_lang[0]=mylist[int(num)]
|
| 271 |
+
else:
|
| 272 |
+
pass
|
| 273 |
+
except Exception as e:
|
| 274 |
+
return f"Error:: {e}"
|
| 275 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 276 |
+
else:
|
| 277 |
+
out_a = 'Done'
|
| 278 |
+
pass
|
| 279 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 280 |
+
return (out_a, out_p)
|
| 281 |
+
|
| 282 |
+
def proc7(img):
|
| 283 |
+
rand = random.randint(1,3000)
|
| 284 |
+
time.sleep(rand/1000)
|
| 285 |
+
new_num=len(num1)-1
|
| 286 |
+
num = new_num
|
| 287 |
+
print (f"new_num: {new_num}")
|
| 288 |
+
if int(num) <= (ser_len - 1):
|
| 289 |
+
num1.append(1)
|
| 290 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 291 |
+
print(f"lang: {lang}")
|
| 292 |
+
out = model7(img,lang)
|
| 293 |
+
print (f'bounds: {out}')
|
| 294 |
+
try:
|
| 295 |
+
if float(out) > float(targ[0]):
|
| 296 |
+
targ[0] = out
|
| 297 |
+
targ_lang[0]=mylist[int(num)]
|
| 298 |
+
else:
|
| 299 |
+
pass
|
| 300 |
+
except Exception as e:
|
| 301 |
+
return f"Error:: {e}"
|
| 302 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 303 |
+
else:
|
| 304 |
+
out_a = 'Done'
|
| 305 |
+
pass
|
| 306 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 307 |
+
return (out_a, out_p)
|
| 308 |
+
|
| 309 |
+
def proc8(img):
|
| 310 |
+
rand = random.randint(1,3000)
|
| 311 |
+
time.sleep(rand/1000)
|
| 312 |
+
new_num=len(num1)-1
|
| 313 |
+
num = new_num
|
| 314 |
+
print (f"new_num: {new_num}")
|
| 315 |
+
if int(num) <= (ser_len - 1):
|
| 316 |
+
num1.append(1)
|
| 317 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 318 |
+
print(f"lang: {lang}")
|
| 319 |
+
out = model8(img,lang)
|
| 320 |
+
print (f'bounds: {out}')
|
| 321 |
+
try:
|
| 322 |
+
if float(out) > float(targ[0]):
|
| 323 |
+
targ[0] = out
|
| 324 |
+
targ_lang[0]=mylist[int(num)]
|
| 325 |
+
else:
|
| 326 |
+
pass
|
| 327 |
+
except Exception as e:
|
| 328 |
+
return f"Error:: {e}"
|
| 329 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 330 |
+
else:
|
| 331 |
+
out_a = 'Done'
|
| 332 |
+
pass
|
| 333 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 334 |
+
return (out_a, out_p)
|
| 335 |
+
|
| 336 |
+
def proc9(img):
|
| 337 |
+
rand = random.randint(1,3000)
|
| 338 |
+
time.sleep(rand/1000)
|
| 339 |
+
new_num=len(num1)-1
|
| 340 |
+
num = new_num
|
| 341 |
+
print (f"new_num: {new_num}")
|
| 342 |
+
if int(num) <= (ser_len - 1):
|
| 343 |
+
num1.append(1)
|
| 344 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 345 |
+
print(f"lang: {lang}")
|
| 346 |
+
out = model9(img,lang)
|
| 347 |
+
print (f'bounds: {out}')
|
| 348 |
+
try:
|
| 349 |
+
if float(out) > float(targ[0]):
|
| 350 |
+
targ[0] = out
|
| 351 |
+
targ_lang[0]=mylist[int(num)]
|
| 352 |
+
else:
|
| 353 |
+
pass
|
| 354 |
+
except Exception as e:
|
| 355 |
+
return f"Error:: {e}"
|
| 356 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 357 |
+
else:
|
| 358 |
+
out_a = 'Done'
|
| 359 |
+
pass
|
| 360 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 361 |
+
return (out_a, out_p)
|
| 362 |
+
|
| 363 |
+
def proc10(img):
|
| 364 |
+
rand = random.randint(1,3000)
|
| 365 |
+
time.sleep(rand/1000)
|
| 366 |
+
new_num=len(num1)-1
|
| 367 |
+
num = new_num
|
| 368 |
+
print (f"new_num: {new_num}")
|
| 369 |
+
if int(num) <= (ser_len - 1):
|
| 370 |
+
num1.append(1)
|
| 371 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 372 |
+
print(f"lang: {lang}")
|
| 373 |
+
out = model10(img,lang)
|
| 374 |
+
print (f'bounds: {out}')
|
| 375 |
+
try:
|
| 376 |
+
if float(out) > float(targ[0]):
|
| 377 |
+
targ[0] = out
|
| 378 |
+
targ_lang[0]=mylist[int(num)]
|
| 379 |
+
else:
|
| 380 |
+
pass
|
| 381 |
+
except Exception as e:
|
| 382 |
+
return f"Error:: {e}"
|
| 383 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 384 |
+
else:
|
| 385 |
+
out_a = 'Done'
|
| 386 |
+
pass
|
| 387 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 388 |
+
return (out_a, out_p)
|
| 389 |
+
##################
|
| 390 |
+
def proc11(img):
|
| 391 |
+
rand = random.randint(1,3000)
|
| 392 |
+
time.sleep(rand/1000)
|
| 393 |
+
new_num=len(num1)-1
|
| 394 |
+
num = new_num
|
| 395 |
+
print (f"new_num: {new_num}")
|
| 396 |
+
if int(num) <= (ser_len - 1):
|
| 397 |
+
num1.append(1)
|
| 398 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 399 |
+
print(f"lang: {lang}")
|
| 400 |
+
out = model11(img,lang)
|
| 401 |
+
print (f'bounds: {out}')
|
| 402 |
+
try:
|
| 403 |
+
if float(out) > float(targ[0]):
|
| 404 |
+
targ[0]=out
|
| 405 |
+
targ_lang[0]=mylist[int(num)]
|
| 406 |
+
else:
|
| 407 |
+
pass
|
| 408 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 409 |
+
|
| 410 |
+
except Exception as e:
|
| 411 |
+
out_a = f"Error:: {e} :: {num}"
|
| 412 |
+
else:
|
| 413 |
+
out_a = 'Done'
|
| 414 |
+
pass
|
| 415 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 416 |
+
return (out_a, out_p)
|
| 417 |
+
|
| 418 |
+
def proc12(img):
|
| 419 |
+
rand = random.randint(1,3000)
|
| 420 |
+
time.sleep(rand/1000)
|
| 421 |
+
new_num=len(num1)-1
|
| 422 |
+
num = new_num
|
| 423 |
+
print (f"new_num: {new_num}")
|
| 424 |
+
if int(num) <= (ser_len - 1):
|
| 425 |
+
num1.append(1)
|
| 426 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 427 |
+
print(f"lang: {lang}")
|
| 428 |
+
out = model12(img,lang)
|
| 429 |
+
print (f'bounds: {out}')
|
| 430 |
+
try:
|
| 431 |
+
if float(out) > float(targ[0]):
|
| 432 |
+
targ[0] = out
|
| 433 |
+
targ_lang[0]=mylist[int(num)]
|
| 434 |
+
else:
|
| 435 |
+
pass
|
| 436 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 437 |
+
except Exception as e:
|
| 438 |
+
out_a = f"Error:: {e} :: {num}"
|
| 439 |
+
else:
|
| 440 |
+
out_a = 'Done'
|
| 441 |
+
pass
|
| 442 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 443 |
+
return (out_a, out_p)
|
| 444 |
+
|
| 445 |
+
def proc13(img):
|
| 446 |
+
rand = random.randint(1,3000)
|
| 447 |
+
time.sleep(rand/1000)
|
| 448 |
+
new_num=len(num1)-1
|
| 449 |
+
num = new_num
|
| 450 |
+
print (f"new_num: {new_num}")
|
| 451 |
+
if int(num) <= (ser_len - 1):
|
| 452 |
+
num1.append(1)
|
| 453 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 454 |
+
print(f"lang: {lang}")
|
| 455 |
+
out = model13(img,lang)
|
| 456 |
+
print (f'bounds: {out}')
|
| 457 |
+
try:
|
| 458 |
+
if float(out) > float(targ[0]):
|
| 459 |
+
targ[0] = out
|
| 460 |
+
targ_lang[0]=mylist[int(num)]
|
| 461 |
+
else:
|
| 462 |
+
pass
|
| 463 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 464 |
+
|
| 465 |
+
except Exception as e:
|
| 466 |
+
out_a = f"Error:: {e} :: {num}"
|
| 467 |
+
else:
|
| 468 |
+
out_a = 'Done'
|
| 469 |
+
pass
|
| 470 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 471 |
+
return (out_a, out_p)
|
| 472 |
+
|
| 473 |
+
def proc14(img):
|
| 474 |
+
rand = random.randint(1,3000)
|
| 475 |
+
time.sleep(rand/1000)
|
| 476 |
+
new_num=len(num1)-1
|
| 477 |
+
num = new_num
|
| 478 |
+
print (f"new_num: {new_num}")
|
| 479 |
+
if int(num) <= (ser_len - 1):
|
| 480 |
+
num1.append(1)
|
| 481 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 482 |
+
print(f"lang: {lang}")
|
| 483 |
+
out = model14(img,lang)
|
| 484 |
+
print (f'bounds: {out}')
|
| 485 |
+
try:
|
| 486 |
+
if float(out) > float(targ[0]):
|
| 487 |
+
targ[0] = out
|
| 488 |
+
targ_lang[0]=mylist[int(num)]
|
| 489 |
+
else:
|
| 490 |
+
pass
|
| 491 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 492 |
+
|
| 493 |
+
except Exception as e:
|
| 494 |
+
out_a = f"Error:: {e} :: {num}"
|
| 495 |
+
else:
|
| 496 |
+
out_a = 'Done'
|
| 497 |
+
pass
|
| 498 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 499 |
+
return (out_a, out_p)
|
| 500 |
+
|
| 501 |
+
def proc15(img):
|
| 502 |
+
rand = random.randint(1,3000)
|
| 503 |
+
time.sleep(rand/1000)
|
| 504 |
+
new_num=len(num1)-1
|
| 505 |
+
num = new_num
|
| 506 |
+
print (f"new_num: {new_num}")
|
| 507 |
+
if int(num) <= (ser_len - 1):
|
| 508 |
+
num1.append(1)
|
| 509 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 510 |
+
print(f"lang: {lang}")
|
| 511 |
+
out = model15(img,lang)
|
| 512 |
+
print (f'bounds: {out}')
|
| 513 |
+
try:
|
| 514 |
+
if float(out) > float(targ[0]):
|
| 515 |
+
targ[0] = out
|
| 516 |
+
targ_lang[0]=mylist[int(num)]
|
| 517 |
+
else:
|
| 518 |
+
pass
|
| 519 |
+
except Exception as e:
|
| 520 |
+
return f"Error:: {e}"
|
| 521 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 522 |
+
else:
|
| 523 |
+
out_a = 'Done'
|
| 524 |
+
pass
|
| 525 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 526 |
+
return (out_a, out_p)
|
| 527 |
+
|
| 528 |
+
def proc16(img):
|
| 529 |
+
rand = random.randint(1,3000)
|
| 530 |
+
time.sleep(rand/1000)
|
| 531 |
+
new_num=len(num1)-1
|
| 532 |
+
num = new_num
|
| 533 |
+
print (f"new_num: {new_num}")
|
| 534 |
+
if int(num) <= (ser_len - 1):
|
| 535 |
+
num1.append(1)
|
| 536 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 537 |
+
print(f"lang: {lang}")
|
| 538 |
+
out = model16(img,lang)
|
| 539 |
+
print (f'bounds: {out}')
|
| 540 |
+
try:
|
| 541 |
+
if float(out) > float(targ[0]):
|
| 542 |
+
targ[0] = out
|
| 543 |
+
targ_lang[0]=mylist[int(num)]
|
| 544 |
+
else:
|
| 545 |
+
pass
|
| 546 |
+
except Exception as e:
|
| 547 |
+
return f"Error:: {e}"
|
| 548 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 549 |
+
else:
|
| 550 |
+
out_a = 'Done'
|
| 551 |
+
pass
|
| 552 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 553 |
+
return (out_a, out_p)
|
| 554 |
+
|
| 555 |
+
def proc17(img):
|
| 556 |
+
rand = random.randint(1,3000)
|
| 557 |
+
time.sleep(rand/1000)
|
| 558 |
+
new_num=len(num1)-1
|
| 559 |
+
num = new_num
|
| 560 |
+
print (f"new_num: {new_num}")
|
| 561 |
+
if int(num) <= (ser_len - 1):
|
| 562 |
+
num1.append(1)
|
| 563 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 564 |
+
print(f"lang: {lang}")
|
| 565 |
+
out = model17(img,lang)
|
| 566 |
+
print (f'bounds: {out}')
|
| 567 |
+
try:
|
| 568 |
+
if float(out) > float(targ[0]):
|
| 569 |
+
targ[0] = out
|
| 570 |
+
targ_lang[0]=mylist[int(num)]
|
| 571 |
+
else:
|
| 572 |
+
pass
|
| 573 |
+
except Exception as e:
|
| 574 |
+
return f"Error:: {e}"
|
| 575 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 576 |
+
else:
|
| 577 |
+
out_a = 'Done'
|
| 578 |
+
pass
|
| 579 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 580 |
+
return (out_a, out_p)
|
| 581 |
+
|
| 582 |
+
def proc18(img):
|
| 583 |
+
rand = random.randint(1,3000)
|
| 584 |
+
time.sleep(rand/1000)
|
| 585 |
+
new_num=len(num1)-1
|
| 586 |
+
num = new_num
|
| 587 |
+
print (f"new_num: {new_num}")
|
| 588 |
+
if int(num) <= (ser_len - 1):
|
| 589 |
+
num1.append(1)
|
| 590 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 591 |
+
print(f"lang: {lang}")
|
| 592 |
+
out = model18(img,lang)
|
| 593 |
+
print (f'bounds: {out}')
|
| 594 |
+
try:
|
| 595 |
+
if float(out) > float(targ[0]):
|
| 596 |
+
targ[0] = out
|
| 597 |
+
targ_lang[0]=mylist[int(num)]
|
| 598 |
+
else:
|
| 599 |
+
pass
|
| 600 |
+
except Exception as e:
|
| 601 |
+
return f"Error:: {e}"
|
| 602 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 603 |
+
else:
|
| 604 |
+
out_a = 'Done'
|
| 605 |
+
pass
|
| 606 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 607 |
+
return (out_a, out_p)
|
| 608 |
+
|
| 609 |
+
def proc19(img):
|
| 610 |
+
rand = random.randint(1,3000)
|
| 611 |
+
time.sleep(rand/1000)
|
| 612 |
+
new_num=len(num1)-1
|
| 613 |
+
num = new_num
|
| 614 |
+
print (f"new_num: {new_num}")
|
| 615 |
+
if int(num) <= (ser_len - 1):
|
| 616 |
+
num1.append(1)
|
| 617 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 618 |
+
print(f"lang: {lang}")
|
| 619 |
+
out = model19(img,lang)
|
| 620 |
+
print (f'bounds: {out}')
|
| 621 |
+
try:
|
| 622 |
+
if float(out) > float(targ[0]):
|
| 623 |
+
targ[0] = out
|
| 624 |
+
targ_lang[0]=mylist[int(num)]
|
| 625 |
+
else:
|
| 626 |
+
pass
|
| 627 |
+
except Exception as e:
|
| 628 |
+
return f"Error:: {e}"
|
| 629 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 630 |
+
else:
|
| 631 |
+
out_a = 'Done'
|
| 632 |
+
pass
|
| 633 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 634 |
+
return (out_a, out_p)
|
| 635 |
+
|
| 636 |
+
def proc20(img):
|
| 637 |
+
rand = random.randint(1,3000)
|
| 638 |
+
time.sleep(rand/1000)
|
| 639 |
+
new_num=len(num1)-1
|
| 640 |
+
num = new_num
|
| 641 |
+
print (f"new_num: {new_num}")
|
| 642 |
+
if int(num) <= (ser_len - 1):
|
| 643 |
+
num1.append(1)
|
| 644 |
+
lang = f"{ocr_id[mylist[int(num)]]}"
|
| 645 |
+
print(f"lang: {lang}")
|
| 646 |
+
out = model20(img,lang)
|
| 647 |
+
print (f'bounds: {out}')
|
| 648 |
+
try:
|
| 649 |
+
if float(out) > float(targ[0]):
|
| 650 |
+
targ[0] = out
|
| 651 |
+
targ_lang[0]=mylist[int(num)]
|
| 652 |
+
else:
|
| 653 |
+
pass
|
| 654 |
+
except Exception as e:
|
| 655 |
+
return f"Error:: {e}"
|
| 656 |
+
out_a = f'{mylist[int(num)]}: {out}'
|
| 657 |
+
else:
|
| 658 |
+
out_a = 'Done'
|
| 659 |
+
pass
|
| 660 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 661 |
+
return (out_a, out_p)
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
|
| 665 |
+
with gr.Blocks() as app:
|
| 666 |
+
|
| 667 |
+
im = gr.Image(type = "filepath")
|
| 668 |
+
ocr_sens=gr.Slider(0.1, 1, step=0.05,value=0.25,label="Detect Min Confidence")
|
| 669 |
+
max_tok=gr.Number(label="Max Tokens",step=1, value=200)
|
| 670 |
+
prob_lang = gr.Textbox(label="Probable Language:")
|
| 671 |
+
det_btn = gr.Button()
|
| 672 |
+
with gr.Accordion("process"):
|
| 673 |
+
out1=gr.Textbox()
|
| 674 |
+
out2=gr.Textbox()
|
| 675 |
+
out3=gr.Textbox()
|
| 676 |
+
out4=gr.Textbox()
|
| 677 |
+
out5=gr.Textbox()
|
| 678 |
+
out6=gr.Textbox()
|
| 679 |
+
out7=gr.Textbox()
|
| 680 |
+
out8=gr.Textbox()
|
| 681 |
+
out9=gr.Textbox()
|
| 682 |
+
out10=gr.Textbox()
|
| 683 |
+
out11=gr.Textbox()
|
| 684 |
+
out12=gr.Textbox()
|
| 685 |
+
out13=gr.Textbox()
|
| 686 |
+
out14=gr.Textbox()
|
| 687 |
+
out15=gr.Textbox()
|
| 688 |
+
out16=gr.Textbox()
|
| 689 |
+
out17=gr.Textbox()
|
| 690 |
+
out18=gr.Textbox()
|
| 691 |
+
out19=gr.Textbox()
|
| 692 |
+
out20=gr.Textbox()
|
| 693 |
+
|
| 694 |
+
det_btn.click(proc0,None,None, show_progress=False)
|
| 695 |
+
|
| 696 |
+
det_btn.click(proc1,[im],[out1,prob_lang], show_progress=False)
|
| 697 |
+
det_btn.click(proc2,[im],[out2,prob_lang], show_progress=False)
|
| 698 |
+
det_btn.click(proc3,[im],[out3,prob_lang], show_progress=False)
|
| 699 |
+
det_btn.click(proc4,[im],[out4,prob_lang], show_progress=False)
|
| 700 |
+
det_btn.click(proc5,[im],[out5,prob_lang], show_progress=False)
|
| 701 |
+
det_btn.click(proc6,[im],[out6,prob_lang], show_progress=False)
|
| 702 |
+
det_btn.click(proc7,[im],[out7,prob_lang], show_progress=False)
|
| 703 |
+
det_btn.click(proc8,[im],[out8,prob_lang], show_progress=False)
|
| 704 |
+
det_btn.click(proc9,[im],[out9,prob_lang], show_progress=False)
|
| 705 |
+
det_btn.click(proc10,[im],[out10,prob_lang], show_progress=False)
|
| 706 |
+
|
| 707 |
+
det_btn.click(proc11,[im],[out11,prob_lang], show_progress=False)
|
| 708 |
+
det_btn.click(proc12,[im],[out12,prob_lang], show_progress=False)
|
| 709 |
+
det_btn.click(proc13,[im],[out13,prob_lang], show_progress=False)
|
| 710 |
+
det_btn.click(proc14,[im],[out14,prob_lang], show_progress=False)
|
| 711 |
+
det_btn.click(proc15,[im],[out15,prob_lang], show_progress=False)
|
| 712 |
+
det_btn.click(proc16,[im],[out16,prob_lang], show_progress=False)
|
| 713 |
+
det_btn.click(proc17,[im],[out17,prob_lang], show_progress=False)
|
| 714 |
+
det_btn.click(proc18,[im],[out18,prob_lang], show_progress=False)
|
| 715 |
+
det_btn.click(proc19,[im],[out19,prob_lang], show_progress=False)
|
| 716 |
+
det_btn.click(proc20,[im],[out20,prob_lang], show_progress=False)
|
| 717 |
+
|
| 718 |
+
|
| 719 |
+
out1.change(proc1,[im],[out1,prob_lang], show_progress=False)
|
| 720 |
+
out2.change(proc2,[im],[out2,prob_lang], show_progress=False)
|
| 721 |
+
out3.change(proc3,[im],[out3,prob_lang], show_progress=False)
|
| 722 |
+
out4.change(proc4,[im],[out4,prob_lang], show_progress=False)
|
| 723 |
+
out5.change(proc5,[im],[out5,prob_lang], show_progress=False)
|
| 724 |
+
out6.change(proc6,[im],[out6,prob_lang], show_progress=False)
|
| 725 |
+
out7.change(proc7,[im],[out7,prob_lang], show_progress=False)
|
| 726 |
+
out8.change(proc8,[im],[out8,prob_lang], show_progress=False)
|
| 727 |
+
out9.change(proc9,[im],[out9,prob_lang], show_progress=False)
|
| 728 |
+
out10.change(proc10,[im],[out10,prob_lang], show_progress=False)
|
| 729 |
+
|
| 730 |
+
out11.change(proc11,[im],[out11,prob_lang], show_progress=False)
|
| 731 |
+
out12.change(proc12,[im],[out12,prob_lang], show_progress=False)
|
| 732 |
+
out13.change(proc13,[im],[out13,prob_lang], show_progress=False)
|
| 733 |
+
out14.change(proc14,[im],[out14,prob_lang], show_progress=False)
|
| 734 |
+
out15.change(proc15,[im],[out15,prob_lang], show_progress=False)
|
| 735 |
+
out16.change(proc16,[im],[out16,prob_lang], show_progress=False)
|
| 736 |
+
out17.change(proc17,[im],[out17,prob_lang], show_progress=False)
|
| 737 |
+
out18.change(proc18,[im],[out18,prob_lang], show_progress=False)
|
| 738 |
+
out19.change(proc19,[im],[out19,prob_lang], show_progress=False)
|
| 739 |
+
out20.change(proc20,[im],[out20,prob_lang], show_progress=False)
|
| 740 |
+
|
| 741 |
+
#det_btn.click(detect_lang,[im,ocr_sens,],det_out)
|
| 742 |
+
app.queue(concurrency_count=100).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
easyocr
|