Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,9 @@ import gradio as gr
|
|
6 |
import torch
|
7 |
import easyocr
|
8 |
|
|
|
|
|
|
|
9 |
def draw_boxes(image, bounds, color='red', width=2):
|
10 |
draw = ImageDraw.Draw(image)
|
11 |
for bound in bounds:
|
@@ -25,10 +28,5 @@ gr.Interface(
|
|
25 |
inference,
|
26 |
[gr.inputs.Image(type='file', label='Input'),gr.inputs.CheckboxGroup(choices, type="value", default=['en', 'vi'], label='language')],
|
27 |
[gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
|
28 |
-
title=title,
|
29 |
-
description=description,
|
30 |
-
article=article,
|
31 |
-
examples=examples,
|
32 |
-
css=css,
|
33 |
enable_queue=True
|
34 |
).launch(debug=True)
|
|
|
6 |
import torch
|
7 |
import easyocr
|
8 |
|
9 |
+
processor = AutoProcessor.from_pretrained("Sharka/CIVQA_LayoutLMv2_EasyOCR")
|
10 |
+
model = AutoModelForDocumentQuestionAnswering.from_pretrained("Sharka/CIVQA_LayoutLMv2_EasyOCR")
|
11 |
+
|
12 |
def draw_boxes(image, bounds, color='red', width=2):
|
13 |
draw = ImageDraw.Draw(image)
|
14 |
for bound in bounds:
|
|
|
28 |
inference,
|
29 |
[gr.inputs.Image(type='file', label='Input'),gr.inputs.CheckboxGroup(choices, type="value", default=['en', 'vi'], label='language')],
|
30 |
[gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
|
|
|
|
|
|
|
|
|
|
|
31 |
enable_queue=True
|
32 |
).launch(debug=True)
|