Spaces:
Sleeping
Sleeping
File size: 1,054 Bytes
c9ccbab df6525b f32be4c 9c28f03 06baaec ad444d3 94dd1d8 df6525b d8cffed 26e0838 d2f7dce ba400dd c9ccbab f28f59a d2f7dce f28f59a 5fe78a4 357d175 7c24b00 27fddcb c9ccbab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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_document")
async def process_document_base64(request: Request,background_tasks: BackgroundTasks):
request_data = await request.json()
# print(request_data)
if request_data.get('user_id') and request_data.get('message_id') and request_data.get('attachment_id') is None:
return {"error":"attachment not present"}
user_id = request_data.get('user_id')
message_id = request_data.get('message_id')
attachment_id = request_data.get('attachment_id')
attachment_extension = request_data.get('attachment_extension')
email = request_data.get('email')
background_tasks.add_task(extract_structure_store_message,user_id,message_id,attachment_id,attachment_extension,email)
return {"status":'Processing and Updating the data to db!'} |