JuanSv commited on
Commit
3901a5e
·
verified ·
1 Parent(s): 047e603

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +23 -0
  2. model.pkl +3 -0
  3. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from fastai.vision.all import load_learner
4
+
5
+ # Cargamos el modelo
6
+ learn = load_learner('model.pkl')
7
+ labels = learn.dls.vocab
8
+
9
+ def predict(img):
10
+ img = PILImage.create(img)
11
+ pred, pred_idx, probs = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ # Interfaz de Gradio
15
+ interface = gr.Interface(
16
+ fn=predict,
17
+ inputs=gr.Image(shape=(512, 512)),
18
+ outputs=gr.Label(num_top_classes=3),
19
+ title="Clasificador de Utensilios de Laboratorio",
20
+ description="Sube una foto de un utensilio para identificarlo."
21
+ )
22
+
23
+ interface.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73c90e917058d6ced8b2983b8bde626fdd28ccbcbfeb96a954d8b846aaeab763
3
+ size 87474183
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+
2
+ fastai
3
+ gradio