Spaces:
Runtime error
Runtime error
File size: 504 Bytes
e345bbb abdee9b d9832c8 abdee9b e345bbb 224c31d d9832c8 e345bbb 1ad3ceb e345bbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pth')
def classify_image(img):
celebrity_name,_,probs = learn.predict(img)
probability = probs[list(learn.dls.vocab).index(celebrity_name)]
return {celebrity_name: probability}
image = gr.inputs.Image(shape=(224,224))
label = gr.outputs.Label()
examples = ['emma_watson.jpg', "tom_hanks.jpeg"]
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
iface.launch(inline=False) |