barabum commited on
Commit
be8014d
1 Parent(s): 5651d98
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import numpy
2
  from sentence_transformers import SentenceTransformer, util
3
  from PIL import Image
4
-
5
 
6
  model = SentenceTransformer('clip-ViT-B-32')
7
 
 
8
  def image_classifier(im1: numpy.ndarray, im2: numpy.ndarray):
9
  encoded_image = model.encode([Image.fromarray(im1), Image.fromarray(im2)], batch_size=128,
10
  convert_to_tensor=True, show_progress_bar=True)
@@ -12,7 +13,6 @@ def image_classifier(im1: numpy.ndarray, im2: numpy.ndarray):
12
  return processed_images[0][0]
13
 
14
 
15
-
16
  with gr.Blocks() as b:
17
  with gr.Row():
18
  with gr.Column():
@@ -23,5 +23,4 @@ with gr.Blocks() as b:
23
  output = gr.Label(label="output")
24
  compare.click(fn=image_classifier, inputs=[image1, image2], outputs=output)
25
 
26
-
27
- b.launch()
 
1
  import numpy
2
  from sentence_transformers import SentenceTransformer, util
3
  from PIL import Image
4
+ import gradio as gr
5
 
6
  model = SentenceTransformer('clip-ViT-B-32')
7
 
8
+
9
  def image_classifier(im1: numpy.ndarray, im2: numpy.ndarray):
10
  encoded_image = model.encode([Image.fromarray(im1), Image.fromarray(im2)], batch_size=128,
11
  convert_to_tensor=True, show_progress_bar=True)
 
13
  return processed_images[0][0]
14
 
15
 
 
16
  with gr.Blocks() as b:
17
  with gr.Row():
18
  with gr.Column():
 
23
  output = gr.Label(label="output")
24
  compare.click(fn=image_classifier, inputs=[image1, image2], outputs=output)
25
 
26
+ b.launch()