Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

allow all cors

Daniel Gatisf339a11036c0
diff --git a/rembg/cli.py b/rembg/cli.py
index 6e8c5bc..10f41b1 100644
--- a/rembg/cli.py
+++ b/rembg/cli.py
@@ -10,6 +10,7 @@ import filetype
import uvicorn
from asyncer import asyncify
from fastapi import Depends, FastAPI, File, Query
+from fastapi.middleware.cors import CORSMiddleware
from starlette.responses import Response
from tqdm import tqdm
from watchdog.events import FileSystemEvent, FileSystemEventHandler
@@ -270,6 +271,14 @@ def s(port: int, log_level: str) -> None:
openapi_tags=tags_metadata,
)
+ app.add_middleware(
+ CORSMiddleware,
+ allow_credentials=True,
+ allow_origins=["*"],
+ allow_methods=["*"],
+ allow_headers=["*"],
+ )
+
class ModelType(str, Enum):
u2net = "u2net"
u2netp = "u2netp"