Spaces:
Runtime error
Runtime error
silly error
Browse files- app.py +5 -6
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -96,7 +96,7 @@ app = FastAPI()
|
|
| 96 |
origins = [
|
| 97 |
"https://huggingface.co",
|
| 98 |
"http://huggingface.co",
|
| 99 |
-
"https://huggingface.co/"
|
| 100 |
"http://huggingface.co/",
|
| 101 |
]
|
| 102 |
|
|
@@ -111,12 +111,11 @@ app.add_middleware(
|
|
| 111 |
|
| 112 |
@app.middleware("http")
|
| 113 |
async def validate_origin(request: Request, call_next):
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
if request.headers.get("referer") not in origins
|
| 117 |
raise HTTPException(status_code=403, detail="Forbidden")
|
| 118 |
-
|
| 119 |
-
return response
|
| 120 |
|
| 121 |
|
| 122 |
@app.get("/image")
|
|
|
|
| 96 |
origins = [
|
| 97 |
"https://huggingface.co",
|
| 98 |
"http://huggingface.co",
|
| 99 |
+
"https://huggingface.co/",
|
| 100 |
"http://huggingface.co/",
|
| 101 |
]
|
| 102 |
|
|
|
|
| 111 |
|
| 112 |
@app.middleware("http")
|
| 113 |
async def validate_origin(request: Request, call_next):
|
| 114 |
+
if DEV:
|
| 115 |
+
return await call_next(request)
|
| 116 |
+
if request.headers.get("referer") not in origins:
|
| 117 |
raise HTTPException(status_code=403, detail="Forbidden")
|
| 118 |
+
return await call_next(request)
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
@app.get("/image")
|
requirements.txt
CHANGED
|
@@ -6,4 +6,5 @@ torch==2.2.0
|
|
| 6 |
uvicorn==0.27.1
|
| 7 |
accelerate
|
| 8 |
safetensors
|
| 9 |
-
transformers
|
|
|
|
|
|
| 6 |
uvicorn==0.27.1
|
| 7 |
accelerate
|
| 8 |
safetensors
|
| 9 |
+
transformers
|
| 10 |
+
peft
|