File size: 741 Bytes
7150be8
 
 
 
dc90bc7
7150be8
 
 
 
 
1013a95
288c09a
 
 
 
 
82a3e0d
288c09a
7150be8
82a3e0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from fastapi import FastAPI, HTTPException,Query,Request,BackgroundTasks
import json
import os
import requests
from extract_insights import process_synchronous_job

app = FastAPI()

@app.post("/process_ocr_text_openai_trigger")
async def process_document_base64(request: Request,background_tasks: BackgroundTasks):
    request_data = await request.json()
    # user_id = request_data.get('user_id')
    # message_id = request_data.get('message_id')
    # email = request_data.get('email')
    # raw_text = request_data.get('receipt_text')
    
    # data = await process_synchronous_job(user_id,email,message_id,raw_text)
    background_tasks.add_task(process_synchronous_job,request_data)
    
    return {"message":"Processing the data!!"}