Spaces:
Sleeping
Sleeping
Create main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, HTTPException,Query,Request,BackgroundTasks
|
| 2 |
+
import json
|
| 3 |
+
from authenticate import get_access_token,get_access_token_v1
|
| 4 |
+
import os
|
| 5 |
+
import requests
|
| 6 |
+
from extract_and_store_supabase import extract_structure_store_message
|
| 7 |
+
|
| 8 |
+
app = FastAPI()
|
| 9 |
+
|
| 10 |
+
@app.post("/process_document")
|
| 11 |
+
async def process_document_base64(request: Request,background_tasks: BackgroundTasks):
|
| 12 |
+
request_data = await request.json()
|
| 13 |
+
file_name = request_data.get('filename')
|
| 14 |
+
|
| 15 |
+
background_tasks.add_task(extract_structure_store_message,filename)
|
| 16 |
+
|
| 17 |
+
return {"status":'Processing and Updating the data to db!'}
|