Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,20 @@
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
-
from pathlib import Path
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
)
|
| 17 |
-
|
| 18 |
-
learn
|
| 19 |
-
learn.load("model_lab")
|
| 20 |
-
|
| 21 |
-
labels = learn.dls.vocab
|
| 22 |
|
| 23 |
def predict(img):
|
| 24 |
img = PILImage.create(img)
|
|
@@ -32,4 +28,4 @@ demo = gr.Interface(
|
|
| 32 |
title="Lab Utensils Classifier"
|
| 33 |
)
|
| 34 |
|
| 35 |
-
demo.launch()
|
|
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
+
# Definir las clases que usaste para entrenar el modelo
|
| 5 |
+
labels = [
|
| 6 |
+
"Vaso de precipitados",
|
| 7 |
+
"Tubos de ensayo",
|
| 8 |
+
"Matraz",
|
| 9 |
+
"Portaobjetos/Cubreobjetos",
|
| 10 |
+
"pipeta",
|
| 11 |
+
"Placa petri",
|
| 12 |
+
"No es un utensilio de laboratorio"
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
# Cargar el modelo directamente (debe estar en la misma carpeta o en models/)
|
| 16 |
+
learn = vision_learner(dls=None, arch=resnet34) # dls=None porque no hay dataset
|
| 17 |
+
learn.load("model_lab") # si lo pusiste en models/, usa "models/model_lab"
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def predict(img):
|
| 20 |
img = PILImage.create(img)
|
|
|
|
| 28 |
title="Lab Utensils Classifier"
|
| 29 |
)
|
| 30 |
|
| 31 |
+
demo.launch()
|