Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,9 @@ model2 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
|
| 85 |
#model19 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 86 |
#model20 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 87 |
mylist = []
|
| 88 |
-
|
|
|
|
|
|
|
| 89 |
mylist.append(key)
|
| 90 |
|
| 91 |
num1 =[]
|
|
@@ -96,7 +98,7 @@ targ=[]
|
|
| 96 |
targ.append(0)
|
| 97 |
|
| 98 |
targ_lang=[]
|
| 99 |
-
targ_lang.append(
|
| 100 |
print (targ_lang[0])
|
| 101 |
ser_len=len(ocr_id)
|
| 102 |
|
|
@@ -122,13 +124,16 @@ def proc1(img):
|
|
| 122 |
try:
|
| 123 |
if float(out) > float(targ[0]):
|
| 124 |
targ[0]=out
|
|
|
|
| 125 |
else:
|
| 126 |
pass
|
| 127 |
except Exception as e:
|
| 128 |
return f"Error:: {e}"
|
| 129 |
else:
|
| 130 |
pass
|
| 131 |
-
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def proc2(img):
|
| 134 |
new_num=len(num1)-1
|
|
@@ -143,14 +148,16 @@ def proc2(img):
|
|
| 143 |
try:
|
| 144 |
if float(out) > float(targ[0]):
|
| 145 |
targ[0] = out
|
|
|
|
|
|
|
| 146 |
else:
|
| 147 |
pass
|
| 148 |
except Exception as e:
|
| 149 |
return f"Error:: {e}"
|
| 150 |
else:
|
| 151 |
pass
|
| 152 |
-
|
| 153 |
-
return (targ[0],
|
| 154 |
|
| 155 |
|
| 156 |
|
|
|
|
| 85 |
#model19 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 86 |
#model20 = gr.Interface.load("spaces/Omnibus/detect-language-ocr")
|
| 87 |
mylist = []
|
| 88 |
+
myval = []
|
| 89 |
+
for value, key in ocr_id.items():
|
| 90 |
+
myval.append(value)
|
| 91 |
mylist.append(key)
|
| 92 |
|
| 93 |
num1 =[]
|
|
|
|
| 98 |
targ.append(0)
|
| 99 |
|
| 100 |
targ_lang=[]
|
| 101 |
+
targ_lang.append(myval[0])
|
| 102 |
print (targ_lang[0])
|
| 103 |
ser_len=len(ocr_id)
|
| 104 |
|
|
|
|
| 124 |
try:
|
| 125 |
if float(out) > float(targ[0]):
|
| 126 |
targ[0]=out
|
| 127 |
+
targ_lang[0]=myval[int(num)]
|
| 128 |
else:
|
| 129 |
pass
|
| 130 |
except Exception as e:
|
| 131 |
return f"Error:: {e}"
|
| 132 |
else:
|
| 133 |
pass
|
| 134 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 135 |
+
|
| 136 |
+
return (targ[0], out_p)
|
| 137 |
|
| 138 |
def proc2(img):
|
| 139 |
new_num=len(num1)-1
|
|
|
|
| 148 |
try:
|
| 149 |
if float(out) > float(targ[0]):
|
| 150 |
targ[0] = out
|
| 151 |
+
targ_lang[0]=myval[int(num)]
|
| 152 |
+
|
| 153 |
else:
|
| 154 |
pass
|
| 155 |
except Exception as e:
|
| 156 |
return f"Error:: {e}"
|
| 157 |
else:
|
| 158 |
pass
|
| 159 |
+
out_p = f'{targ_lang[0]}: {targ[0]}'
|
| 160 |
+
return (targ[0], out_p)
|
| 161 |
|
| 162 |
|
| 163 |
|