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()