Armandoliv commited on
Commit
120daf4
1 Parent(s): 323f2e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
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
- print("doc",type(doc))
167
  img, detected = detect(doc)
168
- print("img ", type(img))
169
  n_detected = get_detected(img, detected)
170
- print("n_detected ",type(n_detected ))
171
  dic_predicted = predict_elements(img, n_detected)
172
- print("dic_predicted ",type(dic_predicted ), dic_predicted.keys() )
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
- print("Keys final")
178
- print(dic_predicted.keys())
179
- print(f"img_out {im_out}")
180
- print(f"{im_out.shape}")
181
- return 'demo.docx', im_out, dic_predicted
 
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")]