mandaaarina commited on
Commit
7c63d93
verified
1 Parent(s): fb7c9e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -1,7 +1,31 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ from fastai.vision.all import load_learner, PILImage
4
+
5
+ # Cargar el modelo utilizando load_learner
6
 
7
+ learn = load_learner('model.pkl')
8
+
9
+ labels = learn.dls.vocab
10
+
11
+ def predict(img):
12
+
13
+ img = PILImage.create(img)
14
+
15
+ pred, pred_idx, probs = learn.predict(img)
16
+
17
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
18
+
19
+ # Crear la interfaz con t铆tulo y descripci贸n
20
+
21
+ gr.Interface(
22
+
23
+ fn=predict,
24
+
25
+ inputs=gr.Image(),
26
+
27
+ outputs=gr.Label(num_top_classes=3),
28
+
29
+ title="Brain and "fruits" classifier"",
30
+
31
+ description="This model identifies between real brains, prunes and walnuts in images.".launch()