rushic24 commited on
Commit
d0eb713
1 Parent(s): cb18727

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from huggingface_hub import from_pretrained_keras
4
+
5
+ siamese = from_pretrained_keras("rushic24/keras-siamese-contrastive")
6
+
7
+ def predict_image(img1, img2):
8
+ assert img1.shape == (28, 28)
9
+ assert img1.shape == img2.shape
10
+ print('img 1 shape', img1.shape)
11
+ img1 = np.expand_dims(img1, 0)
12
+ img2 = np.expand_dims(img2, 0)
13
+ lab = str(siamese.predict([img1, img2])[0][0])
14
+ return lab
15
+
16
+ iface = gr.Interface(predict_image, inputs=["sketchpad", "sketchpad"], outputs="label")
17
+ iface.launch(debug='True')