File size: 648 Bytes
10e6345
ca64f28
00cfc37
10e6345
 
1f10f42
10e6345
ddccc80
00cfc37
10e6345
 
 
 
 
 
ddccc80
10e6345
ddccc80
10e6345
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Human or Animal application in gradio.

import gradio as gr
from fastai.vision.all import *
import skimage

loaded_generic_model = load_learner('model_generic.pkl')
#loaded_special_model = load_learner('model_special.pkl')


def predict_human_or_animal(img):
    im = PILImage.create(img)
    generic_class, generic_class_id, generic_probs = loaded_generic_model.predict(img)
    #special_class, special_class_id, special_probs = loaded_special_model.predict(img)
    
    return {generic_class: float(generic_probs[generic_class_id])}
    
intf = gr.Interface(fn=predict_human_or_animal, inputs="image", outputs="label").launch(share=True)