Spaces:
Sleeping
Sleeping
File size: 1,094 Bytes
d5a1d7f 202db95 d5a1d7f 00229e1 598cf2e 7a2a559 598cf2e 00229e1 d999f4d 210ca57 37dbd96 611eefc 598cf2e d1f58af d5a1d7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from fastapi import FastAPI, HTTPException,Query,Request,BackgroundTasks
import json
from authenticate import get_access_token,get_access_token_v1
import os
import requests
from extract_and_store_supabase import extract_structure_store_message
app = FastAPI()
@app.post("/process_uploaded_document")
async def process_document_base64(request: Request,background_tasks: BackgroundTasks):
request_data = await request.json()
# print(request_data.get('filename'))
file_name_ = request_data.get('filename').split('/')[-1]
file_name = request_data.get('filename').split('/')[-5:]
file_name_path = '/'.join(file_name)
print("printing filename")
print(file_name)
user_id = request_data.get('user_id')
email = request_data.get('email')
# attachment_extension = request_data.get('attachment_extension')
print(user_id)
await extract_structure_store_message(file_name_,file_name_path,user_id,email)
# background_tasks.add_task(extract_structure_store_message,file_name,user_id)
return {"status":'Processing and Updating the data to db!'} |