mindwrapped commited on
Commit
f4142af
1 Parent(s): 190d9d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -4,20 +4,18 @@ from huggingface_hub import from_pretrained_fastai
4
 
5
  learn = from_pretrained_fastai('mindwrapped/pokemon-card-checker')
6
 
7
- def check_card(input_img):
8
- pred_label, _, score = learn.predict(input_img)
9
- label_map = {
10
- '1': 'real',
11
- '0': 'fake'
12
- }
13
- return {'real': score[1], 'fake': score[0]}
14
 
15
  demo = gr.Interface(
16
  fn=check_card,
17
- inputs=gr.Image(shape=(256, 256)),
18
  outputs="label",
19
- examples=['real-1.jpeg','real-2.jpeg','fake-1.jpeg','fake-2.jpeg'],
20
  title='Pokemon Card Checker',
21
- 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).')
 
22
 
23
  demo.launch()
 
4
 
5
  learn = from_pretrained_fastai('mindwrapped/pokemon-card-checker')
6
 
7
+ def check_card(image):
8
+ pred_label, _, scores = learn.predict(image)
9
+ scores = scores.detach().numpy()
10
+ return {'real': float(scores[1]), 'fake': float(scores[0])}
 
 
 
11
 
12
  demo = gr.Interface(
13
  fn=check_card,
14
+ inputs="image",
15
  outputs="label",
16
+ 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'],
17
  title='Pokemon Card Checker',
18
+ 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).',
19
+ )
20
 
21
  demo.launch()