Spaces:
Sleeping
Sleeping
Hiroaki Ogasawara
commited on
Commit
·
78e2e40
1
Parent(s):
380a483
feat: app.py and packages
Browse files- .python-version +1 -0
- app.py +24 -0
- pyproject.toml +11 -0
- uv.lock +0 -0
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.12.7
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
+
import imagehash
|
4 |
+
|
5 |
+
def compare_images(img1, img2):
|
6 |
+
if img1 is None or img2 is None:
|
7 |
+
return "画像を2つともアップロードしてください。"
|
8 |
+
hash1 = imagehash.average_hash(img1)
|
9 |
+
hash2 = imagehash.average_hash(img2)
|
10 |
+
diff = hash1 - hash2
|
11 |
+
return f"2つの画像のハッシュ差異は: {diff} です。"
|
12 |
+
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=compare_images,
|
15 |
+
inputs=[
|
16 |
+
gr.Image(type="pil"),
|
17 |
+
gr.Image(type="pil")
|
18 |
+
],
|
19 |
+
outputs="text",
|
20 |
+
title="画像ハッシュ差分計算アプリ",
|
21 |
+
description="2つの画像をアップロードして、imagehashでハッシュの差を計算します。"
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|
pyproject.toml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "imagehash-playground"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "Add your description here"
|
5 |
+
readme = "README.md"
|
6 |
+
requires-python = ">=3.12.7"
|
7 |
+
dependencies = [
|
8 |
+
"gradio>=5.3.0",
|
9 |
+
"imagehash>=4.3.1",
|
10 |
+
"pillow>=10.4.0",
|
11 |
+
]
|
uv.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|