Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,6 +109,7 @@ zerogpu_fix_js = """
|
|
| 109 |
if (currentHeaders) {
|
| 110 |
options = updateHeaders(options, currentHeaders);
|
| 111 |
console.log("ZeroGPU Fix: Injected FRESH headers");
|
|
|
|
| 112 |
} else {
|
| 113 |
options = updateHeaders(options, headers);
|
| 114 |
console.log("ZeroGPU Fix: Injected CACHED headers (refresh failed)");
|
|
@@ -172,6 +173,7 @@ def generate_image_handler(x, negative_prompt, fine_edge, fix_perspective, grow_
|
|
| 172 |
positive_prompt = x['from_backend']['prompt']
|
| 173 |
|
| 174 |
# 1. Extract headers from the current user's request
|
|
|
|
| 175 |
forward_headers = get_zerogpu_headers(request.headers)
|
| 176 |
|
| 177 |
# 打印调试信息,确认是否收到了 x-zerogpu-token
|
|
@@ -186,7 +188,7 @@ def generate_image_handler(x, negative_prompt, fine_edge, fix_perspective, grow_
|
|
| 186 |
# 2. Instantiate a client specifically for this request with the forwarded headers.
|
| 187 |
# This ensures the backend sees the 'x-zerogpu-token' of the user, not the server.
|
| 188 |
# gradio_client caches schemas, so re-init is relatively cheap but necessary for headers.
|
| 189 |
-
client = Client(BACKEND_URL
|
| 190 |
|
| 191 |
# Call the backend API
|
| 192 |
res_base64 = client.predict(
|
|
|
|
| 109 |
if (currentHeaders) {
|
| 110 |
options = updateHeaders(options, currentHeaders);
|
| 111 |
console.log("ZeroGPU Fix: Injected FRESH headers");
|
| 112 |
+
console.log(options.headers)
|
| 113 |
} else {
|
| 114 |
options = updateHeaders(options, headers);
|
| 115 |
console.log("ZeroGPU Fix: Injected CACHED headers (refresh failed)");
|
|
|
|
| 173 |
positive_prompt = x['from_backend']['prompt']
|
| 174 |
|
| 175 |
# 1. Extract headers from the current user's request
|
| 176 |
+
print(request.headers)
|
| 177 |
forward_headers = get_zerogpu_headers(request.headers)
|
| 178 |
|
| 179 |
# 打印调试信息,确认是否收到了 x-zerogpu-token
|
|
|
|
| 188 |
# 2. Instantiate a client specifically for this request with the forwarded headers.
|
| 189 |
# This ensures the backend sees the 'x-zerogpu-token' of the user, not the server.
|
| 190 |
# gradio_client caches schemas, so re-init is relatively cheap but necessary for headers.
|
| 191 |
+
client = Client(BACKEND_URL)
|
| 192 |
|
| 193 |
# Call the backend API
|
| 194 |
res_base64 = client.predict(
|