Spaces:
Runtime error
Runtime error
alitavanaali
commited on
Commit
•
5dd336b
1
Parent(s):
07111e1
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,10 @@ for k,v in id2label.items():
|
|
47 |
else:
|
48 |
label2color[v[2:]]=label_color[k]
|
49 |
|
|
|
50 |
processor = AutoProcessor.from_pretrained("microsoft/layoutlmv3-base", apply_ocr=True,lang=lang)
|
51 |
-
model = AutoModelForTokenClassification.from_pretrained("
|
|
|
52 |
|
53 |
|
54 |
def unnormalize_box(bbox, width, height):
|
@@ -406,7 +408,7 @@ css = """.output_image, .input_image {height: 600px !important}"""
|
|
406 |
#examples = [["461BHH69.PDF"],["AP-481-RF.PDF"],["DP-095-ML.PDF"],["DQ-231-LL.PDF"],["FK-941-ET.PDF"], ["FL-078-NH.PDF"]
|
407 |
# ,["14ZZ69.PDF"],["74BCA69.PDF"],["254BEG69.PDF"],["761BJQ69.PDF"],["AB-486-EH.PDF"],["AZ-211-ZA.PDF"], ["CY-073-YV.PDF"]]
|
408 |
# ["744BJQ69.PDF"], ['tarros_2.jpg'],
|
409 |
-
|
410 |
|
411 |
|
412 |
iface = gr.Interface(fn=completepreprocess,
|
@@ -416,7 +418,7 @@ iface = gr.Interface(fn=completepreprocess,
|
|
416 |
outputs=[gr.outputs.Image(type="pil", label="annotated image"),"dataframe"] ,
|
417 |
title=title,
|
418 |
description=description,
|
419 |
-
|
420 |
css=css,
|
421 |
analytics_enabled = True, enable_queue=True)
|
422 |
|
|
|
47 |
else:
|
48 |
label2color[v[2:]]=label_color[k]
|
49 |
|
50 |
+
|
51 |
processor = AutoProcessor.from_pretrained("microsoft/layoutlmv3-base", apply_ocr=True,lang=lang)
|
52 |
+
model = AutoModelForTokenClassification.from_pretrained("alitavanaali/music_layoutlmv3_model")
|
53 |
+
feature_extractor = LayoutLMv3FeatureExtractor(apply_ocr=True,lang=lang)
|
54 |
|
55 |
|
56 |
def unnormalize_box(bbox, width, height):
|
|
|
408 |
#examples = [["461BHH69.PDF"],["AP-481-RF.PDF"],["DP-095-ML.PDF"],["DQ-231-LL.PDF"],["FK-941-ET.PDF"], ["FL-078-NH.PDF"]
|
409 |
# ,["14ZZ69.PDF"],["74BCA69.PDF"],["254BEG69.PDF"],["761BJQ69.PDF"],["AB-486-EH.PDF"],["AZ-211-ZA.PDF"], ["CY-073-YV.PDF"]]
|
410 |
# ["744BJQ69.PDF"], ['tarros_2.jpg'],
|
411 |
+
examples = [['test1.jpg'], ['doc1.pdf'], ['doc1.2.pdf']]
|
412 |
|
413 |
|
414 |
iface = gr.Interface(fn=completepreprocess,
|
|
|
418 |
outputs=[gr.outputs.Image(type="pil", label="annotated image"),"dataframe"] ,
|
419 |
title=title,
|
420 |
description=description,
|
421 |
+
examples=examples,
|
422 |
css=css,
|
423 |
analytics_enabled = True, enable_queue=True)
|
424 |
|