Dileep7729 commited on
Commit
e79d95e
·
verified ·
1 Parent(s): c82fa0d

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -24
app.py DELETED
@@ -1,24 +0,0 @@
1
- import gradio as gr
2
- from transformers import LayoutLMv3Processor, LayoutLMv3ForTokenClassification
3
- from PIL import Image
4
-
5
- # Load model and processor
6
- processor = LayoutLMv3Processor.from_pretrained("quadranttechnologies/Table_OCR")
7
- model = LayoutLMv3ForTokenClassification.from_pretrained("quadranttechnologies/Table_OCR")
8
-
9
- def predict(image):
10
- inputs = processor(images=image, return_tensors="pt")
11
- outputs = model(**inputs)
12
- predictions = outputs.logits.argmax(-1).squeeze().tolist()
13
- return {"results": predictions}
14
-
15
- # Gradio interface
16
- iface = gr.Interface(
17
- fn=predict,
18
- inputs=gr.Image(type="pil"),
19
- outputs="json",
20
- title="Table OCR",
21
- description="Upload a receipt or document image to extract structured information.",
22
- )
23
-
24
- iface.launch()