SEE7 commited on
Commit
e2cae95
·
verified ·
1 Parent(s): 66474d0

Preserve Hugging Face visitor headers through the Gradio bridge

Browse files
Files changed (1) hide show
  1. llama_ui.py +1 -1
llama_ui.py CHANGED
@@ -118,7 +118,7 @@ def install_ui(app):
118
  # Keep Gradio's OAuth, queue, visitor identity and ZeroGPU scheduling context.
119
  # Do not call the GPU-decorated function directly from a FastAPI route.
120
  headers = {k: v for k, v in request.headers.items()
121
- if k.lower() in ("cookie", "authorization") or k.lower().startswith("x-hf-")}
122
  client = httpx.AsyncClient(timeout=httpx.Timeout(90, connect=5), trust_env=False)
123
  try:
124
  submitted = await client.post("http://127.0.0.1:7860/gradio_api/call/chat",
 
118
  # Keep Gradio's OAuth, queue, visitor identity and ZeroGPU scheduling context.
119
  # Do not call the GPU-decorated function directly from a FastAPI route.
120
  headers = {k: v for k, v in request.headers.items()
121
+ if k.lower() in ("cookie", "authorization") or k.lower().startswith("x-")}
122
  client = httpx.AsyncClient(timeout=httpx.Timeout(90, connect=5), trust_env=False)
123
  try:
124
  submitted = await client.post("http://127.0.0.1:7860/gradio_api/call/chat",