Pant0x commited on
Commit
23e2bb0
·
1 Parent(s): 668cd87

Update API URLs to point to Hugging Face Backend and support HF_TOKEN

Browse files
Files changed (1) hide show
  1. services/api_service.py +6 -5
services/api_service.py CHANGED
@@ -26,13 +26,14 @@ def _headers(token: str | None = None) -> dict:
26
  h = {"Accept": "application/json"}
27
  hf_token = os.getenv("HF_TOKEN")
28
 
29
- if token:
30
- # User session token
31
- h["Authorization"] = f"Bearer {token}"
32
- elif hf_token:
33
- # Fallback to HF space token for public endpoints (like OCR inference)
34
  h["Authorization"] = f"Bearer {hf_token}"
35
 
 
 
 
 
36
  return h
37
 
38
 
 
26
  h = {"Accept": "application/json"}
27
  hf_token = os.getenv("HF_TOKEN")
28
 
29
+ # Hugging Face needs this to let the request through the Private Space proxy
30
+ if hf_token:
 
 
 
31
  h["Authorization"] = f"Bearer {hf_token}"
32
 
33
+ # Backend will read the user session from this new header
34
+ if token:
35
+ h["X-Supabase-Auth"] = f"Bearer {token}"
36
+
37
  return h
38
 
39