Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,13 +45,13 @@ def predict(img) -> Tuple[Dict, float]:
|
|
| 45 |
|
| 46 |
# Create a prediction label and prediction probability dictionary for each prediction class (this is the required format for Gradio's output parameter)
|
| 47 |
pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))}
|
| 48 |
-
pred_labels_and_prob_1={"Unknown Image" if v <0.75 else k:v for k,v in pred_labels_and_prob.items()}
|
| 49 |
|
| 50 |
# Calculate the prediction time
|
| 51 |
pred_time = round(timer() - start_time, 5)
|
| 52 |
|
| 53 |
# Return the prediction dictionary and prediction time
|
| 54 |
-
return
|
| 55 |
|
| 56 |
### 4. Gradio app ###
|
| 57 |
|
|
|
|
| 45 |
|
| 46 |
# Create a prediction label and prediction probability dictionary for each prediction class (this is the required format for Gradio's output parameter)
|
| 47 |
pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))}
|
| 48 |
+
#pred_labels_and_prob_1={"Unknown Image" if v <0.75 else k:v for k,v in pred_labels_and_prob.items()}
|
| 49 |
|
| 50 |
# Calculate the prediction time
|
| 51 |
pred_time = round(timer() - start_time, 5)
|
| 52 |
|
| 53 |
# Return the prediction dictionary and prediction time
|
| 54 |
+
return pred_labels_and_probs, pred_time
|
| 55 |
|
| 56 |
### 4. Gradio app ###
|
| 57 |
|