Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def _load_image(path: str) -> np.ndarray:
|
|
| 51 |
|
| 52 |
|
| 53 |
# ββ REPORT BUILDER ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 54 |
-
def _build_text(r: dict) -> str:
|
| 55 |
isnt = r["isnt"]
|
| 56 |
|
| 57 |
lines = [
|
|
@@ -74,8 +74,9 @@ def _build_text(r: dict) -> str:
|
|
| 74 |
f" Disc Area : {r['disc_area_px']:,} px",
|
| 75 |
f" Cup Area : {r['cup_area_px']:,} px",
|
| 76 |
f" Cup/Disc : {r['cup_area_px'] / max(r['disc_area_px'], 1) * 100:.1f}%",
|
| 77 |
-
f" MC Passes : {
|
| 78 |
]
|
|
|
|
| 79 |
|
| 80 |
warnings = r.get("warnings", [])
|
| 81 |
if warnings:
|
|
@@ -130,7 +131,7 @@ def analyse(file_path):
|
|
| 130 |
result = pipeline.run(img)
|
| 131 |
print("Pipeline inference completed.")
|
| 132 |
|
| 133 |
-
text = _build_text(result["report"])
|
| 134 |
pdf = _build_pdf(text)
|
| 135 |
|
| 136 |
status = "Analysis completed successfully."
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
# ββ REPORT BUILDER ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 54 |
+
def _build_text(r: dict, mc_passes: int) -> str:
|
| 55 |
isnt = r["isnt"]
|
| 56 |
|
| 57 |
lines = [
|
|
|
|
| 74 |
f" Disc Area : {r['disc_area_px']:,} px",
|
| 75 |
f" Cup Area : {r['cup_area_px']:,} px",
|
| 76 |
f" Cup/Disc : {r['cup_area_px'] / max(r['disc_area_px'], 1) * 100:.1f}%",
|
| 77 |
+
f" MC Passes : {mc_passes}",
|
| 78 |
]
|
| 79 |
+
|
| 80 |
|
| 81 |
warnings = r.get("warnings", [])
|
| 82 |
if warnings:
|
|
|
|
| 131 |
result = pipeline.run(img)
|
| 132 |
print("Pipeline inference completed.")
|
| 133 |
|
| 134 |
+
text = _build_text(result["report"], pipeline.mc_passes)
|
| 135 |
pdf = _build_pdf(text)
|
| 136 |
|
| 137 |
status = "Analysis completed successfully."
|