Spaces:
Runtime error
Runtime error
File size: 776 Bytes
af17fa6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from fastai.vision.all import *
import gradio as gr
def get_label(fname):
return 'forged' if fname.name.split("-")[3] == 'F' else 'genuine'
learn = load_learner("model-BHSig260-Bengali.pkl")
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
_,_,probs = learn.predict(img)
return dict(zip(labels, map(float, probs)))
examples = [PILImage.create(img) for img in ["B-S-2-F-03.tif", "B-S-2-F-17.tif", "B-S-2-G-01.tif"]]
title = "Handwritten Signature Verification App"
description = "A handwritten signature verification App trained on the Handwritten Signature Datasets in Kaggle with fastai."
intf = gr.Interface(fn=predict, inputs="image", outputs="label", title=title, description=description, examples=examples)
intf.launch(inline=False)
|