MingGatsby
commited on
Commit
•
9c123f3
1
Parent(s):
0117147
Update app.py
Browse files
app.py
CHANGED
@@ -177,8 +177,21 @@ if uploaded_ct_file is not None:
|
|
177 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".dcm") as temp_file:
|
178 |
temp_file.write(uploaded_ct_file.getvalue())
|
179 |
|
180 |
-
#
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
# Predict
|
184 |
with torch.no_grad():
|
|
|
177 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".dcm") as temp_file:
|
178 |
temp_file.write(uploaded_ct_file.getvalue())
|
179 |
|
180 |
+
# Debugging section to isolate the RuntimeError issue
|
181 |
+
try:
|
182 |
+
# Check if the temporary DICOM file is accessible and properly written
|
183 |
+
if not os.path.exists(temp_file.name) or os.path.getsize(temp_file.name) == 0:
|
184 |
+
print("Debugging: Temporary DICOM file is either missing or empty.")
|
185 |
+
|
186 |
+
# Attempt to apply the evaluation transforms to the DICOM image
|
187 |
+
image_tensor = eval_transforms(temp_file.name).unsqueeze(0).to(device)
|
188 |
+
|
189 |
+
except Exception as e:
|
190 |
+
print(f"Debugging: Exception caught while applying transform: {e}")
|
191 |
+
raise
|
192 |
+
|
193 |
+
# # Apply evaluation transforms to the DICOM image for model prediction
|
194 |
+
# image_tensor = eval_transforms(temp_file.name).unsqueeze(0).to(device)
|
195 |
|
196 |
# Predict
|
197 |
with torch.no_grad():
|