from fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.responses import HTMLResponse from fastapi.responses import StreamingResponse from fastapi.responses import FileResponse from fastapi.middleware.cors import CORSMiddleware from io import StringIO import os import uuid,requests app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.post("/get_image_for_text") async def get_image_for_text(email,query,file: UploadFile = File(...)):