Spaces:
Runtime error
Runtime error
File size: 1,112 Bytes
e10e3fa e828d81 f4142af e10e3fa a4d339b e10e3fa 462216f f4142af 190d9d1 f4142af e10e3fa f6e75c6 984367f f4142af e10e3fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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(img):
pred_label, _, scores = learn.predict(img)
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. \n\n[Dataset](https://www.kaggle.com/datasets/ongshujian/real-and-fake-pokemon-cards) created by [Shujian Ong](https://www.kaggle.com/ongshujian).',
article='Can you guess which cards are real and fake? \n\nI can\'t :D \n\n([View Labels](https://gist.github.com/mindwrapped/e5aad747757ef006037a1a1982be34fc)) \n\n![visitor badge](https://visitor-badge.glitch.me/badge?page_id=mindwrapped.pokemon-card-checker-space)',
live=False,
)
demo.launch() |