radames commited on
Commit
c3efa02
1 Parent(s): e12a439

silly error

Browse files
Files changed (2) hide show
  1. app.py +5 -6
  2. 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
- logging.info(f"Request from {request.headers.get('referer')}")
115
- logging.info(f"Request from {request.headers}")
116
- if request.headers.get("referer") not in origins and not DEV:
117
  raise HTTPException(status_code=403, detail="Forbidden")
118
- response = await call_next(request)
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