rushic24's picture
Create app.py
d0eb713
raw history blame
No virus
537 Bytes
import gradio as gr
import numpy as np
from huggingface_hub import from_pretrained_keras
siamese = from_pretrained_keras("rushic24/keras-siamese-contrastive")
def predict_image(img1, img2):
assert img1.shape == (28, 28)
assert img1.shape == img2.shape
print('img 1 shape', img1.shape)
img1 = np.expand_dims(img1, 0)
img2 = np.expand_dims(img2, 0)
lab = str(siamese.predict([img1, img2])[0][0])
return lab
iface = gr.Interface(predict_image, inputs=["sketchpad", "sketchpad"], outputs="label")
iface.launch(debug='True')