Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
learner = load_learner("models/batch_size_64_device_cuda_lr_0.01_n_epoch_30_seed_42_valid_pct_0.2.pkl") | |
labels = learner.dls.vocab | |
def classify(img): | |
pred, pred_idx, probs = learner.predict(img) | |
return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
interface = gr.Interface(fn=classify, inputs="sketchpad", outputs=gr.outputs.Label(num_top_classes=5), live=True) | |
interface.launch(debug=True, share=True) |