Spaces:
Sleeping
Sleeping
Commit
·
313504e
1
Parent(s):
d14339d
add code
Browse files- app/main.py +1 -1
app/main.py
CHANGED
@@ -39,6 +39,7 @@ def initialize_model():
|
|
39 |
except Exception as e:
|
40 |
logging.error(f"❌ Failed to load model: {e}")
|
41 |
|
|
|
42 |
CLASS_NAMES = [
|
43 |
"bacterial_leaf_blight", "brown_spot", "healthy", "leaf_blast",
|
44 |
"leaf_scald", "narrow_brown_spot", "rice_hispa", "sheath_blight", "tungro"
|
@@ -100,7 +101,6 @@ def home():
|
|
100 |
|
101 |
@app.post("/predict")
|
102 |
async def predict(file: UploadFile = File(...)):
|
103 |
-
initialize_model()
|
104 |
if MODEL is None:
|
105 |
return {"error": "Model failed to load."}
|
106 |
|
|
|
39 |
except Exception as e:
|
40 |
logging.error(f"❌ Failed to load model: {e}")
|
41 |
|
42 |
+
initialize_model()
|
43 |
CLASS_NAMES = [
|
44 |
"bacterial_leaf_blight", "brown_spot", "healthy", "leaf_blast",
|
45 |
"leaf_scald", "narrow_brown_spot", "rice_hispa", "sheath_blight", "tungro"
|
|
|
101 |
|
102 |
@app.post("/predict")
|
103 |
async def predict(file: UploadFile = File(...)):
|
|
|
104 |
if MODEL is None:
|
105 |
return {"error": "Model failed to load."}
|
106 |
|