Spaces:
Runtime error
Runtime error
File size: 781 Bytes
cc966a6 593be4c cc966a6 1c28f34 cc966a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from fastai.vision.all import load_learner
import gradio as gr
labels=(
'African people picture',
'British people picture',
'East Asain people picture',
'Eskimo people picture',
'European people picture',
'Indigenous American people picture',
'Indigenous Australians people picture',
'Indigenous people picture',
'Negrito people picture',
'Semitic people picture'
)
model=load_learner(f'humanRace-v11.pkl')
def recognize_image(image):
pred, idx, probs=model.predict(image)
print(pred)
return dict(zip(labels, map(float, probs)))
image = gr.Image(image_mode="RGB")
label=gr.Label()
example=['th(11).jpeg']
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label,examples=example )
iface.launch(inline=False, share=True)
|