Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,20 +23,18 @@ def process(input_pdf):
|
|
23 |
|
24 |
image_path = os.path.join(temp_dir, image_name)
|
25 |
|
26 |
-
output = model.inference(image=image_path, prompt=task_prompt)["predictions"][0]
|
27 |
-
|
28 |
os.remove(image_path)
|
29 |
os.rmdir(temp_dir)
|
30 |
|
31 |
-
return
|
32 |
|
33 |
-
task_name = "SGSInvoice"
|
34 |
-
task_prompt = f"<s_{task_name}>"
|
35 |
|
36 |
-
model = DonutModel.from_pretrained("uartimcs/donut-invoice-extract")
|
37 |
-
model.eval()
|
38 |
|
39 |
-
demo = gr.Interface(fn=process,inputs=gr.File(label="Upload PDF File"),outputs="
|
40 |
demo.launch()
|
41 |
|
42 |
|
|
|
23 |
|
24 |
image_path = os.path.join(temp_dir, image_name)
|
25 |
|
|
|
|
|
26 |
os.remove(image_path)
|
27 |
os.rmdir(temp_dir)
|
28 |
|
29 |
+
return image_path
|
30 |
|
31 |
+
# task_name = "SGSInvoice"
|
32 |
+
# task_prompt = f"<s_{task_name}>"
|
33 |
|
34 |
+
# model = DonutModel.from_pretrained("uartimcs/donut-invoice-extract")
|
35 |
+
# model.eval()
|
36 |
|
37 |
+
demo = gr.Interface(fn=process,inputs=gr.File(label="Upload PDF File"),outputs=gr.File(label="Output File"), title=f"Donut 🍩 demonstration for `{task_name}` task",)
|
38 |
demo.launch()
|
39 |
|
40 |
|