Ziad Meligy commited on
Commit
4a58046
·
1 Parent(s): bfe1fa6

Pushing to space Dicom

Browse files
Files changed (1) hide show
  1. main.py +5 -8
main.py CHANGED
@@ -77,8 +77,10 @@ async def generate_report_dicom(file: UploadFile = File(...)):
77
 
78
  # Convert DICOM to PNG
79
  image = dicom_to_png(dicom_data)
80
-
81
- report= generate_report(image) # Generate report using the image
 
 
82
 
83
  # Get additional DICOM metadata for context
84
  metadata = {}
@@ -112,9 +114,4 @@ async def generate_report_dicom(file: UploadFile = File(...)):
112
  except HTTPException:
113
  raise
114
  except Exception as e:
115
- return JSONResponse({"error": str(e)}, status_code=500)
116
-
117
-
118
-
119
-
120
-
 
77
 
78
  # Convert DICOM to PNG
79
  image = dicom_to_png(dicom_data)
80
+ image_io = io.BytesIO()
81
+ image.save(image_io, format="PNG")
82
+ image_data = image_io.getvalue()
83
+ report= generate_report(image_data) # Generate report using the image
84
 
85
  # Get additional DICOM metadata for context
86
  metadata = {}
 
114
  except HTTPException:
115
  raise
116
  except Exception as e:
117
+ return JSONResponse({"error": str(e)}, status_code=500)