Spaces:
Sleeping
Sleeping
Commit
·
ddd17bc
1
Parent(s):
3a9f19d
Update
Browse files
backend/__pycache__/app.cpython-312.pyc
CHANGED
|
Binary files a/backend/__pycache__/app.cpython-312.pyc and b/backend/__pycache__/app.cpython-312.pyc differ
|
|
|
backend/app.py
CHANGED
|
@@ -810,8 +810,14 @@ async def generate_report(
|
|
| 810 |
html_url = f"/outputs/reports/{report_id}/report.html"
|
| 811 |
annotated_img = report_data.get("analysis", {}).get("annotated_image_url") or ""
|
| 812 |
|
| 813 |
-
#
|
| 814 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 815 |
|
| 816 |
download_pdf_btn = f'<a href="{pdf_url}" download style="text-decoration:none"><button class="btn-secondary">Download PDF</button></a>' if pdf_url else ''
|
| 817 |
|
|
|
|
| 810 |
html_url = f"/outputs/reports/{report_id}/report.html"
|
| 811 |
annotated_img = report_data.get("analysis", {}).get("annotated_image_url") or ""
|
| 812 |
|
| 813 |
+
# Use relative path (same origin) for annotated image so the report works both
|
| 814 |
+
# locally and when deployed (avoid hardcoding localhost or a specific port).
|
| 815 |
+
# If `annotated_img` is an absolute URL (starts with http), leave it unchanged.
|
| 816 |
+
if annotated_img and annotated_img.startswith('http'):
|
| 817 |
+
annotated_img_full = annotated_img
|
| 818 |
+
else:
|
| 819 |
+
# Keep relative path like "/outputs/images/.." so browser requests same host
|
| 820 |
+
annotated_img_full = annotated_img or ""
|
| 821 |
|
| 822 |
download_pdf_btn = f'<a href="{pdf_url}" download style="text-decoration:none"><button class="btn-secondary">Download PDF</button></a>' if pdf_url else ''
|
| 823 |
|