Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,6 @@ from huggingface_hub import from_pretrained_fastai
|
|
| 2 |
import gradio as gr
|
| 3 |
from fastai.vision.all import *
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
|
| 8 |
repo_id = "iamacaru/simpsons"
|
| 9 |
|
|
@@ -15,6 +13,10 @@ 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.
|
| 20 |
-
gr.Interface(fn=predict, inputs=
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from fastai.vision.all import *
|
| 4 |
|
|
|
|
|
|
|
| 5 |
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
|
| 6 |
repo_id = "iamacaru/simpsons"
|
| 7 |
|
|
|
|
| 13 |
#img = PILImage.create(img)
|
| 14 |
pred,pred_idx,probs = learner.predict(img)
|
| 15 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 16 |
+
|
| 17 |
+
# Nueva forma de definir entradas y salidas
|
| 18 |
+
inputs = gr.Image(shape=(128, 128))
|
| 19 |
+
outputs = gr.Label(num_top_classes=3)
|
| 20 |
|
| 21 |
# Creamos la interfaz y la lanzamos.
|
| 22 |
+
gr.Interface(fn=predict, inputs=inputs, outputs=outputs,examples=['apu.jpg','homer.jpg']).launch(share=False)
|