Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,14 +12,12 @@ from donut import DonutModel
|
|
12 |
|
13 |
def demo_process(input_img):
|
14 |
global pretrained_model, task_prompt, task_name
|
15 |
-
# input_img = Image.fromarray(input_img)
|
16 |
output = pretrained_model.inference(image=input_img, prompt=task_prompt)["predictions"][0]
|
17 |
return output
|
18 |
|
19 |
task_prompt = f"<s_data-donut_mixed>"
|
20 |
|
21 |
pretrained_model = DonutModel.from_pretrained("RustX/donut-base-finetuned-insurance")
|
22 |
-
#pretrained_model.encoder.to(torch.bfloat16)
|
23 |
pretrained_model.eval()
|
24 |
|
25 |
demo = gr.Interface(
|
@@ -28,7 +26,7 @@ demo = gr.Interface(
|
|
28 |
outputs="json",
|
29 |
title=f"Donut 🍩 demonstration for `insurance` task",
|
30 |
description="""This model is trained with 294 Korean insurance images of custom dataset.""",
|
31 |
-
examples=[["donut_sample_insurance1.jpg"], ["donut_sample_insurance2.jpg"]],
|
32 |
cache_examples=False,
|
33 |
)
|
34 |
|
|
|
12 |
|
13 |
def demo_process(input_img):
|
14 |
global pretrained_model, task_prompt, task_name
|
|
|
15 |
output = pretrained_model.inference(image=input_img, prompt=task_prompt)["predictions"][0]
|
16 |
return output
|
17 |
|
18 |
task_prompt = f"<s_data-donut_mixed>"
|
19 |
|
20 |
pretrained_model = DonutModel.from_pretrained("RustX/donut-base-finetuned-insurance")
|
|
|
21 |
pretrained_model.eval()
|
22 |
|
23 |
demo = gr.Interface(
|
|
|
26 |
outputs="json",
|
27 |
title=f"Donut 🍩 demonstration for `insurance` task",
|
28 |
description="""This model is trained with 294 Korean insurance images of custom dataset.""",
|
29 |
+
#examples=[["donut_sample_insurance1.jpg"], ["donut_sample_insurance2.jpg"]],
|
30 |
cache_examples=False,
|
31 |
)
|
32 |
|