File size: 756 Bytes
e10e3fa
 
 
 
 
 
 
190d9d1
 
 
 
 
 
e10e3fa
 
462216f
e10e3fa
190d9d1
e10e3fa
 
462216f
e10e3fa
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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(input_img):
    pred_label, _, score = learn.predict(input_img)
    label_map = {
      '1': 'real',
      '0': 'fake'
    }
    return {'real': score[1], 'fake': score[0]}

demo = gr.Interface(
  fn=check_card, 
  inputs=gr.Image(shape=(256, 256)),
  outputs="label",
  examples=['real-1.jpeg','real-2.jpeg','fake-1.jpeg','fake-2.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()