|
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') |
|
|
|
background_tasks.add_task(process_synchronous_job,user_id,email,message_id,raw_text) |
|
|
|
return {"message":"Processing the data!!"} |