File size: 432 Bytes
9b66dad
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
from fastai.vision.all import load_learner

learner = load_learner('saved_model/export.pkl')
categories = ('Has structure', 'Does Not Have structure')

def is_it_a_structure(input_img):
    pred, idx, probs = learner.predict(input_img)
    return f'{pred} {dict(zip(categories, map(float, probs)))}'

demo = gr.Interface(fn=is_it_a_structure, inputs=gr.Image(shape=(200, 200)), outputs=gr.Label())

demo.launch()