Spaces:
Sleeping
Sleeping
referer
Browse files
app.py
CHANGED
@@ -23,6 +23,7 @@ logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
|
|
23 |
MAX_SEED = np.iinfo(np.int32).max
|
24 |
USE_TORCH_COMPILE = os.environ.get("USE_TORCH_COMPILE", "0") == "1"
|
25 |
SPACE_ID = os.environ.get("SPACE_ID", "")
|
|
|
26 |
|
27 |
DB_PATH = Path("/data/cache") if SPACE_ID else Path("./cache")
|
28 |
IMGS_PATH = DB_PATH / "imgs"
|
@@ -107,8 +108,7 @@ app.add_middleware(
|
|
107 |
|
108 |
@app.middleware("http")
|
109 |
async def validate_origin(request: Request, call_next):
|
110 |
-
|
111 |
-
if request.headers.get("origin") not in origins:
|
112 |
raise HTTPException(status_code=403, detail="Forbidden")
|
113 |
response = await call_next(request)
|
114 |
return response
|
|
|
23 |
MAX_SEED = np.iinfo(np.int32).max
|
24 |
USE_TORCH_COMPILE = os.environ.get("USE_TORCH_COMPILE", "0") == "1"
|
25 |
SPACE_ID = os.environ.get("SPACE_ID", "")
|
26 |
+
DEV = os.environ.get("DEV", "0") == "1"
|
27 |
|
28 |
DB_PATH = Path("/data/cache") if SPACE_ID else Path("./cache")
|
29 |
IMGS_PATH = DB_PATH / "imgs"
|
|
|
108 |
|
109 |
@app.middleware("http")
|
110 |
async def validate_origin(request: Request, call_next):
|
111 |
+
if request.headers.get("origin") not in origins and not DEV:
|
|
|
112 |
raise HTTPException(status_code=403, detail="Forbidden")
|
113 |
response = await call_next(request)
|
114 |
return response
|