Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -6,12 +6,12 @@ import requests
|
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
|
| 9 |
-
class
|
| 10 |
document: str # URL of the bill document
|
| 11 |
|
| 12 |
|
| 13 |
@app.post("/extract-bill-data")
|
| 14 |
-
async def extract_bill_data(req:
|
| 15 |
document_url = req.document
|
| 16 |
|
| 17 |
# 1) Download the document from URL
|
|
@@ -33,8 +33,7 @@ async def extract_bill_data(req: ExtractRequest):
|
|
| 33 |
}
|
| 34 |
|
| 35 |
file_bytes = resp.content
|
| 36 |
-
# TODO:
|
| 37 |
-
|
| 38 |
except Exception as e:
|
| 39 |
# Graceful failure with valid schema
|
| 40 |
return {
|
|
@@ -51,7 +50,7 @@ async def extract_bill_data(req: ExtractRequest):
|
|
| 51 |
"error": str(e)
|
| 52 |
}
|
| 53 |
|
| 54 |
-
# 2) Minimal valid response for first submission
|
| 55 |
pagewise_line_items = []
|
| 56 |
total_item_count = 0
|
| 57 |
|
|
|
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
|
| 9 |
+
class ExtractRqst(BaseModel):
|
| 10 |
document: str # URL of the bill document
|
| 11 |
|
| 12 |
|
| 13 |
@app.post("/extract-bill-data")
|
| 14 |
+
async def extract_bill_data(req: ExtractRqst):
|
| 15 |
document_url = req.document
|
| 16 |
|
| 17 |
# 1) Download the document from URL
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
file_bytes = resp.content
|
| 36 |
+
# TODO: plugging OCR + extraction pipeline + LLm pipeline for summarization and more including the differentiators
|
|
|
|
| 37 |
except Exception as e:
|
| 38 |
# Graceful failure with valid schema
|
| 39 |
return {
|
|
|
|
| 50 |
"error": str(e)
|
| 51 |
}
|
| 52 |
|
| 53 |
+
# 2) Minimal valid response as of now for first submission. Updating it continuosly t0 meet the requirements.
|
| 54 |
pagewise_line_items = []
|
| 55 |
total_item_count = 0
|
| 56 |
|