Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,23 +37,23 @@ print("Model Vocabulary:", learn.dls.vocab)
|
|
| 37 |
|
| 38 |
labels = learn.dls.vocab
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
-
def predict(img):
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
|
| 59 |
# def predict(img):
|
|
|
|
| 37 |
|
| 38 |
labels = learn.dls.vocab
|
| 39 |
|
| 40 |
+
def predict(img):
|
| 41 |
+
img = PILImage.create(img)
|
| 42 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 43 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
+
# def predict(img):
|
| 48 |
+
# img = PILImage.create(img)
|
| 49 |
+
# pred, pred_idx, probs = learn.predict(img)
|
| 50 |
+
# results = {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 51 |
+
# # Adjust results to highlight when 'Survived' meets the 75% threshold
|
| 52 |
+
# if results['Survived'] <= 0.1:
|
| 53 |
+
# results['Survived'] = 1.0 # Indicating high confidence of survival
|
| 54 |
+
# else:
|
| 55 |
+
# results['Survived'] = 0.0 # Indicating it did not meet the threshold
|
| 56 |
+
# return results
|
| 57 |
|
| 58 |
|
| 59 |
# def predict(img):
|