Commit ยท
2c17e80
1
Parent(s): c9aa851
Resolve host and protocol dynamically from proxy headers in start_tryon_wrapper
Browse files270 unmodified lines271272273274275276277278270 unmodified linesreturn result_img, mask_img# If called from Gradio, construct the markdown link with all images generated in this sessionhost = request.headers.get("host", "localhost:7860") if request else "localhost:7860"proto = "https" if "hf.space" in host else "http"base_url = f"{proto}://{host}"url = f"{base_url}/static/outputs/{output_filename}"270 unmodified lines271272273274275276277278270 unmodified linesreturn result_img, mask_img# If called from Gradio, construct the markdown link with all images generated in this sessionhost = request.headers.get("x-forwarded-host", request.headers.get("host", "localhost:7860")) if request else "localhost:7860"proto = request.headers.get("x-forwarded-proto", "https" if "hf.space" in host else "http") if request else "http"base_url = f"{proto}://{host}"url = f"{base_url}/static/outputs/{output_filename}"
app.py+2-2