GabrielMI commited on
Commit
1b9f30c
·
verified ·
1 Parent(s): df4a39d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import from_pretrained_fastai
2
+ import gradio as gr
3
+ from fastai.vision.all import *
4
+
5
+ repo_id = "GabrielMI/entregable2"
6
+
7
+ learner = from_pretrained_fastai(repo_id)
8
+ labels = learner.dls.vocab
9
+
10
+ def predict(img):
11
+ pred,pred_idx,probs = learner.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label(num_top_classes=3),examples=['fry.jpg','leela.jpg']).launch(share=False)