Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,12 @@ from fastai.vision.all import *
|
|
| 8 |
repo_id = "joheras/intel-image-classification"
|
| 9 |
|
| 10 |
learner = from_pretrained_fastai(repo_id)
|
|
|
|
| 11 |
|
| 12 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
| 13 |
def predict(img):
|
| 14 |
img = PILImage.create(img)
|
| 15 |
-
pred,pred_idx,probs =
|
| 16 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 17 |
|
| 18 |
# Creamos la interfaz y la lanzamos.
|
|
|
|
| 8 |
repo_id = "joheras/intel-image-classification"
|
| 9 |
|
| 10 |
learner = from_pretrained_fastai(repo_id)
|
| 11 |
+
labels = learn.dls.vocab
|
| 12 |
|
| 13 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
| 14 |
def predict(img):
|
| 15 |
img = PILImage.create(img)
|
| 16 |
+
pred,pred_idx,probs = learner.predict(img)
|
| 17 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 18 |
|
| 19 |
# Creamos la interfaz y la lanzamos.
|