Update inference_manager.py
Browse files- inference_manager.py +5 -5
inference_manager.py
CHANGED
@@ -73,10 +73,9 @@ class AuthHelper:
|
|
73 |
|
74 |
def check_auth(self, request, token):
|
75 |
# Extract parameters from the request
|
76 |
-
params
|
77 |
-
if params.get("_skip_token_passkey", "") == "nsfwaisio_125687":
|
78 |
return True
|
79 |
-
|
80 |
# Gather request-specific information
|
81 |
sip = request.client.host
|
82 |
shost = request.headers.get("Host", "")
|
@@ -322,6 +321,7 @@ class ModelManager:
|
|
322 |
self.ext_models = {}
|
323 |
self.model_directory = model_directory
|
324 |
self.load_models()
|
|
|
325 |
|
326 |
#not enabled at the moment
|
327 |
def load_instant_x(self):
|
@@ -416,7 +416,7 @@ class ModelManager:
|
|
416 |
|
417 |
@spaces.GPU(duration=40)
|
418 |
def generate_with_faceid(self, model_id, request, inference_params, progress=gr.Progress(track_tqdm=True)):
|
419 |
-
auth_helper.check_auth(request, token)
|
420 |
model = self.models.get(model_id)
|
421 |
if not model:
|
422 |
raise Exception(f"invalid model_id {model_id}")
|
@@ -495,7 +495,7 @@ class ModelManager:
|
|
495 |
pipe._guidance_scale = 0.0
|
496 |
|
497 |
return callback_kwargs
|
498 |
-
auth_helper.check_auth(request, token)
|
499 |
model = self.models.get(model_id)
|
500 |
if not model:
|
501 |
raise Exception(f"invalid model_id {model_id}")
|
|
|
73 |
|
74 |
def check_auth(self, request, token):
|
75 |
# Extract parameters from the request
|
76 |
+
if params.get("_skip_token_passkey", "") == "nsfwaisio_125687" or not request:
|
|
|
77 |
return True
|
78 |
+
params = dict(request.query_params)
|
79 |
# Gather request-specific information
|
80 |
sip = request.client.host
|
81 |
shost = request.headers.get("Host", "")
|
|
|
321 |
self.ext_models = {}
|
322 |
self.model_directory = model_directory
|
323 |
self.load_models()
|
324 |
+
self.auth_helper = AuthHelper()
|
325 |
|
326 |
#not enabled at the moment
|
327 |
def load_instant_x(self):
|
|
|
416 |
|
417 |
@spaces.GPU(duration=40)
|
418 |
def generate_with_faceid(self, model_id, request, inference_params, progress=gr.Progress(track_tqdm=True)):
|
419 |
+
self.auth_helper.check_auth(request, token)
|
420 |
model = self.models.get(model_id)
|
421 |
if not model:
|
422 |
raise Exception(f"invalid model_id {model_id}")
|
|
|
495 |
pipe._guidance_scale = 0.0
|
496 |
|
497 |
return callback_kwargs
|
498 |
+
self.auth_helper.check_auth(request, token)
|
499 |
model = self.models.get(model_id)
|
500 |
if not model:
|
501 |
raise Exception(f"invalid model_id {model_id}")
|