Shreyaanp commited on
Commit
0d277e9
1 Parent(s): 604512f

add commit

Browse files
Files changed (1) hide show
  1. ihash-256.py +27 -0
ihash-256.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+ import gradio as gr
3
+ css = """
4
+ footer {visibility: hidden}
5
+ """
6
+
7
+
8
+ def check(original_image, verified_image):
9
+ # Compute the hash code of the original image
10
+ original_hash = hashlib.sha256(original_image).hexdigest()
11
+
12
+ # Compute the hash code of the image to be verified
13
+ verified_hash = hashlib.sha256(verified_image).hexdigest()
14
+
15
+ # Compare the two hash codes
16
+ if original_hash == verified_hash:
17
+ result = "The image is authentic."
18
+ return result, original_hash, verified_hash
19
+ else:
20
+ result = "The image has been modified or corrupted."
21
+ return result, original_hash, verified_hash
22
+
23
+ iface = gr.Interface(fn=check, inputs=["image", "image"], outputs=["text", "text", "text"],
24
+ title="Image Hash Checker", description="Check if an image has been modified or corrupted.",
25
+ css=css, )
26
+
27
+ iface.launch()