05prey commited on
Commit
fb033f4
·
verified ·
1 Parent(s): cf8c1e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -35,13 +35,30 @@ async def upload_sink(file: UploadFile = File(...)):
35
 
36
  dt = time.time() - start
37
  mb = total / (1024**2)
38
- resp = {
39
  "filename": file.filename,
40
  "received_mb": round(mb, 2),
41
  "duration_sec": round(dt, 2),
42
  "throughput_mb_s": round(mb / dt, 2) if dt > 0 else 0.0,
43
  }
44
- print("receiving:", resp)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  return resp
46
 
47
  # Optional: print PORT for debugging in container logs
 
35
 
36
  dt = time.time() - start
37
  mb = total / (1024**2)
38
+ stats = {
39
  "filename": file.filename,
40
  "received_mb": round(mb, 2),
41
  "duration_sec": round(dt, 2),
42
  "throughput_mb_s": round(mb / dt, 2) if dt > 0 else 0.0,
43
  }
44
+ print("receiving:", debug)
45
+
46
+
47
+ # # (Optional) save if you want
48
+ # os.makedirs("uploads", exist_ok=True)
49
+ # with open(os.path.join("uploads", file.filename), "wb") as f:
50
+ # f.write(data)
51
+
52
+ # ✅ return what the frontend expects
53
+ resp = {
54
+ "birads": "BIRADS 2",
55
+ "molecular_subtype": "Luminal A",
56
+ "report": f"Received {file.filename} ({size_mb:.2f} MB). Upload time {dt:.2f}s.",
57
+ "segmentedImageSrc": None,
58
+
59
+ # You can also include your perf stats; UI will ignore unknown keys
60
+ "stats": stats
61
+ }
62
  return resp
63
 
64
  # Optional: print PORT for debugging in container logs