Ahsen Khaliq commited on
Commit
b030c42
1 Parent(s): 64216e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -74,7 +74,13 @@ def inference(img, img2):
74
  hash_bits2 = ''.join(['1' if it >= 0 else '0' for it in hash_output2])
75
  hash_hex2 = '{:0{}x}'.format(int(hash_bits2, 2), len(hash_bits2) // 4)
76
 
77
- return hash_hex, hash_hex2
 
 
 
 
 
 
78
 
79
  title = "AppleNeuralHash"
80
  description = "Gradio demo for Apple NeuralHash, a perceptual hashing method for images based on neural networks. It can tolerate image resize and compression. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
@@ -84,7 +90,7 @@ examples = [['sunset.jpg','rotate.png'],['dog.png','same.png']]
84
  gr.Interface(
85
  inference,
86
  [gr.inputs.Image(type="file", label="Input Image"),gr.inputs.Image(type="file", label="Input Image")],
87
- [gr.outputs.Textbox(label="Output"),gr.outputs.Textbox(label="Output")] ,
88
  title=title,
89
  description=description,
90
  article=article,
 
74
  hash_bits2 = ''.join(['1' if it >= 0 else '0' for it in hash_output2])
75
  hash_hex2 = '{:0{}x}'.format(int(hash_bits2, 2), len(hash_bits2) // 4)
76
 
77
+ if hash_hex == hash_hex2:
78
+ check = "Same Hash"
79
+ else:
80
+ check = "Different Hash"
81
+
82
+
83
+ return check, hash_hex, hash_hex2
84
 
85
  title = "AppleNeuralHash"
86
  description = "Gradio demo for Apple NeuralHash, a perceptual hashing method for images based on neural networks. It can tolerate image resize and compression. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
 
90
  gr.Interface(
91
  inference,
92
  [gr.inputs.Image(type="file", label="Input Image"),gr.inputs.Image(type="file", label="Input Image")],
93
+ [gr.outputs.Textbox(label="Check"),gr.outputs.Textbox(label="First Hash"),gr.outputs.Textbox(label="Second Hash")] ,
94
  title=title,
95
  description=description,
96
  article=article,