Spaces:
Runtime error
Runtime error
mindwrapped
commited on
Commit
•
e10e3fa
1
Parent(s):
c6af60c
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import gradio as gr
|
3 |
+
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 |
+
sepia_filter = np.array(
|
9 |
+
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
10 |
+
)
|
11 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
12 |
+
sepia_img /= sepia_img.max()
|
13 |
+
return sepia_img
|
14 |
+
|
15 |
+
demo = gr.Interface(
|
16 |
+
fn=sepia,
|
17 |
+
inputs=gr.Image(shape=(256, 256)),
|
18 |
+
outputs="image",
|
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()
|