Spaces:
Sleeping
Sleeping
Commit
·
c22f142
1
Parent(s):
472e9bb
temp
Browse files
app.py
CHANGED
|
@@ -7,8 +7,6 @@ import io
|
|
| 7 |
import uvicorn
|
| 8 |
import tempfile
|
| 9 |
import cv2
|
| 10 |
-
import os
|
| 11 |
-
assert os.path.exists("trained_modela.keras"), "Model file not found!"
|
| 12 |
|
| 13 |
|
| 14 |
# Initialize FastAPI app
|
|
@@ -115,13 +113,9 @@ async def predict_disease(file: UploadFile = File(...)):
|
|
| 115 |
"disease": disease_name,
|
| 116 |
"confidence": confidence
|
| 117 |
}
|
| 118 |
-
|
| 119 |
-
finally:
|
| 120 |
-
# Delete the temporary file manually
|
| 121 |
-
if os.path.exists(temp_path):
|
| 122 |
-
os.remove(temp_path)
|
| 123 |
|
| 124 |
|
|
|
|
| 125 |
except Exception as e:
|
| 126 |
raise HTTPException(status_code=500, detail=f"Prediction error: {str(e)}")
|
| 127 |
|
|
|
|
| 7 |
import uvicorn
|
| 8 |
import tempfile
|
| 9 |
import cv2
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# Initialize FastAPI app
|
|
|
|
| 113 |
"disease": disease_name,
|
| 114 |
"confidence": confidence
|
| 115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
+
|
| 119 |
except Exception as e:
|
| 120 |
raise HTTPException(status_code=500, detail=f"Prediction error: {str(e)}")
|
| 121 |
|