scriptfish's picture
map float
1a23676
raw
history blame contribute delete
No virus
479 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('instrument_model.pkl');
vocab = ['clarinet', 'french horn', 'oboe', 'oboe d amore', 'saxophone', 'trombone', 'trumpet']
def classify_image(image):
pre, idx, probs = learn.predict(image)
return dict(zip(vocab, map(float, probs)))
image = gr.inputs.Image(shape=(250, 250))
label = gr.outputs.Label()
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)