Shreyaanp commited on
Commit
8d316a5
·
1 Parent(s): bd82901
Files changed (1) hide show
  1. ihash-256.ipynb +17 -10
ihash-256.ipynb CHANGED
@@ -2,14 +2,14 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 20,
6
  "metadata": {},
7
  "outputs": [
8
  {
9
  "name": "stderr",
10
  "output_type": "stream",
11
  "text": [
12
- "c:\\Users\\pshre\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Interface, please remove them: {'inputs_description': ['Upload original image', 'Upload verified image'], 'output_description': 'Result'}\n",
13
  " warnings.warn(\n"
14
  ]
15
  },
@@ -17,7 +17,7 @@
17
  "name": "stdout",
18
  "output_type": "stream",
19
  "text": [
20
- "Running on local URL: http://127.0.0.1:7871\n",
21
  "\n",
22
  "To create a public link, set `share=True` in `launch()`.\n"
23
  ]
@@ -25,7 +25,7 @@
25
  {
26
  "data": {
27
  "text/html": [
28
- "<div><iframe src=\"http://127.0.0.1:7871/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
29
  ],
30
  "text/plain": [
31
  "<IPython.core.display.HTML object>"
@@ -38,7 +38,7 @@
38
  "data": {
39
  "text/plain": []
40
  },
41
- "execution_count": 20,
42
  "metadata": {},
43
  "output_type": "execute_result"
44
  }
@@ -46,6 +46,14 @@
46
  "source": [
47
  "import hashlib\n",
48
  "import gradio as gr\n",
 
 
 
 
 
 
 
 
49
  "\n",
50
  "def check(original_image, verified_image):\n",
51
  " # Compute the hash code of the original image\n",
@@ -62,11 +70,10 @@
62
  " result = \"The image has been modified or corrupted.\"\n",
63
  " return result, original_hash, verified_hash\n",
64
  "\n",
65
- "iface = gr.Interface(fn=check, inputs=[\"image\", \"image\"], outputs=[gr.outputs.Textbox(label=\"Result\", type=\"text\") , \n",
66
- " gr.outputs.Textbox(label=\"Original Hash\", type=\"text\"), \n",
67
- " gr.outputs.Textbox(label=\"Verified Hash\", type=\"text\")], \n",
68
- " inputs_description=[\"Upload original image\", \"Upload verified image\"],\n",
69
- " output_description=\"Result\")\n",
70
  "\n",
71
  "iface.launch()\n"
72
  ]
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 7,
6
  "metadata": {},
7
  "outputs": [
8
  {
9
  "name": "stderr",
10
  "output_type": "stream",
11
  "text": [
12
+ "c:\\Users\\pshre\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Interface, please remove them: {'output_description': 'Result'}\n",
13
  " warnings.warn(\n"
14
  ]
15
  },
 
17
  "name": "stdout",
18
  "output_type": "stream",
19
  "text": [
20
+ "Running on local URL: http://127.0.0.1:7866\n",
21
  "\n",
22
  "To create a public link, set `share=True` in `launch()`.\n"
23
  ]
 
25
  {
26
  "data": {
27
  "text/html": [
28
+ "<div><iframe src=\"http://127.0.0.1:7866/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
29
  ],
30
  "text/plain": [
31
  "<IPython.core.display.HTML object>"
 
38
  "data": {
39
  "text/plain": []
40
  },
41
+ "execution_count": 7,
42
  "metadata": {},
43
  "output_type": "execute_result"
44
  }
 
46
  "source": [
47
  "import hashlib\n",
48
  "import gradio as gr\n",
49
+ "css = \"\"\"\n",
50
+ "footer {visibility: hidden}\n",
51
+ "body {\n",
52
+ " background-color: #f8f8f8;\n",
53
+ " font-family: Arial, sans-serif;\n",
54
+ "}\n",
55
+ "\"\"\"\n",
56
+ "\n",
57
  "\n",
58
  "def check(original_image, verified_image):\n",
59
  " # Compute the hash code of the original image\n",
 
70
  " result = \"The image has been modified or corrupted.\"\n",
71
  " return result, original_hash, verified_hash\n",
72
  "\n",
73
+ "iface = gr.Interface(fn=check, inputs=[\"image\", \"image\"], outputs=[\"text\", \"text\", \"text\"],\n",
74
+ " title=\"Image Hash Checker\", description=\"Check if an image has been modified or corrupted.\",\n",
75
+ " css=css,\n",
76
+ " output_description=\"Result\", )\n",
 
77
  "\n",
78
  "iface.launch()\n"
79
  ]