image_hash_checker / ihash-256.py
Shreyaanp's picture
add commit
0d277e9
raw
history blame contribute delete
No virus
901 Bytes
import hashlib
import gradio as gr
css = """
footer {visibility: hidden}
"""
def check(original_image, verified_image):
# Compute the hash code of the original image
original_hash = hashlib.sha256(original_image).hexdigest()
# Compute the hash code of the image to be verified
verified_hash = hashlib.sha256(verified_image).hexdigest()
# Compare the two hash codes
if original_hash == verified_hash:
result = "The image is authentic."
return result, original_hash, verified_hash
else:
result = "The image has been modified or corrupted."
return result, original_hash, verified_hash
iface = gr.Interface(fn=check, inputs=["image", "image"], outputs=["text", "text", "text"],
title="Image Hash Checker", description="Check if an image has been modified or corrupted.",
css=css, )
iface.launch()