Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI, HTTPException | |
| from models import ImageInpaintingRequest, ImageInpaintingResponse | |
| from utils import process_images_and_inpaint | |
| from typing import List | |
| import uvicorn | |
| app = FastAPI() | |
| def hello(): | |
| return {"message":"Test FastAPI"} | |
| async def inpaint_images(request: ImageInpaintingRequest): | |
| try: | |
| inpainted_image_b64 = process_images_and_inpaint(request.images, request.alpha_gradient_width, request.init_image_height) | |
| return ImageInpaintingResponse(inpainted_image=inpainted_image_b64) | |
| except Exception as e: | |
| print(e) | |
| raise HTTPException(status_code=500, detail=str(e)) | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=8000) |