import numpy as np import gradio as gr from huggingface_hub import from_pretrained_fastai learn = from_pretrained_fastai('mindwrapped/pokemon-card-checker') def check_card(image): pred_label, _, scores = learn.predict(image) scores = scores.detach().numpy() return {'real': float(scores[1]), 'fake': float(scores[0])} demo = gr.Interface( fn=check_card, inputs="image", outputs="label", examples=['real-1.jpeg','real-2.jpeg','fake-1.jpeg','fake-2.jpeg','real-3.jpeg','real-4.jpeg','fake-3.jpeg','fake-4.jpeg'], title='Pokemon Card Checker', description='A resnet34 model fine-tuned to determine whether Pokemon cards are real or fake. Dataset is located [here](https://www.kaggle.com/datasets/ongshujian/real-and-fake-pokemon-cards).', ) demo.launch()