httpsAkayush commited on
Commit
f280e6e
·
1 Parent(s): c22f142

float confidence

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -84,7 +84,7 @@ async def predict_disease(file: UploadFile = File(...)):
84
  # Validate file type
85
 
86
  # Save uploaded file temporarily
87
- with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as tmp:
88
  temp_path = tmp.name
89
  tmp.write(await file.read())
90
  tmp.flush() # Ensure data is written
@@ -103,7 +103,7 @@ async def predict_disease(file: UploadFile = File(...)):
103
  # Predict
104
  prediction = model.predict(input_arr)
105
  result_index = np.argmax(prediction)
106
- confidence = prediction[0][result_index]
107
  disease_name = class_name[result_index]
108
 
109
 
 
84
  # Validate file type
85
 
86
  # Save uploaded file temporarily
87
+ with tempfile.NamedTemporaryFile(suffix=".jpeg", delete=False) as tmp:
88
  temp_path = tmp.name
89
  tmp.write(await file.read())
90
  tmp.flush() # Ensure data is written
 
103
  # Predict
104
  prediction = model.predict(input_arr)
105
  result_index = np.argmax(prediction)
106
+ confidence = float(prediction[0][result_index])
107
  disease_name = class_name[result_index]
108
 
109