Spaces:
Runtime error
Runtime error
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) | |