Spaces:
Running
Running
Armandoliv
commited on
Commit
•
120daf4
1
Parent(s):
323f2e4
Update app.py
Browse files
app.py
CHANGED
@@ -163,22 +163,22 @@ def gen_doc(dic_predicted:dict):
|
|
163 |
def main_convert(filename):
|
164 |
print(filename.name)
|
165 |
doc = to_image(filename.name)
|
166 |
-
|
167 |
img, detected = detect(doc)
|
168 |
-
|
169 |
n_detected = get_detected(img, detected)
|
170 |
-
|
171 |
dic_predicted = predict_elements(img, n_detected)
|
172 |
-
|
173 |
gen_doc(dic_predicted)
|
174 |
-
print("File Generated")
|
175 |
|
176 |
im_out = lp.draw_box(img, detected, box_width=5, box_alpha=0.2, show_element_type=True)
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
182 |
|
183 |
|
184 |
inputs = [gr.File(type='file', label="Original PDF File")]
|
|
|
163 |
def main_convert(filename):
|
164 |
print(filename.name)
|
165 |
doc = to_image(filename.name)
|
166 |
+
|
167 |
img, detected = detect(doc)
|
168 |
+
|
169 |
n_detected = get_detected(img, detected)
|
170 |
+
|
171 |
dic_predicted = predict_elements(img, n_detected)
|
172 |
+
|
173 |
gen_doc(dic_predicted)
|
|
|
174 |
|
175 |
im_out = lp.draw_box(img, detected, box_width=5, box_alpha=0.2, show_element_type=True)
|
176 |
+
dict_out = {}
|
177 |
+
for k,v in dic_predicted.items():
|
178 |
+
if "figure" not in k.lower():
|
179 |
+
dict_out[k] = dic_predicted[k]
|
180 |
+
|
181 |
+
return 'demo.docx', im_out, dict_out
|
182 |
|
183 |
|
184 |
inputs = [gr.File(type='file', label="Original PDF File")]
|