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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -5,13 +5,17 @@ from huggingface_hub import from_pretrained_fastai
5
  learn = from_pretrained_fastai('mindwrapped/pokemon-card-checker')
6
 
7
  def check_card(input_img):
8
- pred = learn.predict(input_img)
9
- return pred
 
 
 
 
10
 
11
  demo = gr.Interface(
12
  fn=check_card,
13
  inputs=gr.Image(shape=(256, 256)),
14
- outputs="text",
15
  examples=['real-1.jpeg','real-2.jpeg','fake-1.jpeg','fake-2.jpeg'],
16
  title='Pokemon Card Checker',
17
  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).')
 
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).')