Omkar008's picture
Update main.py
0a1d2de verified
raw
history blame
696 Bytes
from fastapi import FastAPI, HTTPException,Query,Request,BackgroundTasks
import json
import os
import requests
from extract_insights import extract_fashion_categories
app = FastAPI()
@app.post("/update_fashion_categories")
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')
await extract_fashion_categories(user_id,email,message_id)
# background_tasks.add_task(extract_fashion_categories,user_id,email,message_id)
return {"status":'Processing and Updating the data to db!'}