Ark-kun commited on
Commit
bb5af01
·
1 Parent(s): 560d306

Unauthorized users raise HTTP 401 UNAUTHORIZED error

Browse files
huggingface_overlay/start_HuggingFace.py CHANGED
@@ -216,14 +216,20 @@ if IS_HUGGINGFACE_SPACE:
216
  f"Error getting authentication info from HuggingFace.",
217
  exc_info=True,
218
  )
219
-
220
- return api_router.UserDetails(
221
- name="anonymous",
222
- permissions=api_router.Permissions(
223
- read=any_user_can_read,
224
- write=False,
225
- admin=False,
226
- ),
 
 
 
 
 
 
227
  )
228
 
229
  else:
 
216
  f"Error getting authentication info from HuggingFace.",
217
  exc_info=True,
218
  )
219
+ # Return unauthenticated
220
+ # return api_router.UserDetails(
221
+ # # name="anonymous",
222
+ # name=None,
223
+ # permissions=api_router.Permissions(
224
+ # read=any_user_can_read,
225
+ # write=False,
226
+ # admin=False,
227
+ # ),
228
+ # )
229
+ # return None
230
+ raise fastapi.HTTPException(
231
+ status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
232
+ detail="Unauthenticated",
233
  )
234
 
235
  else: