Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch.nn.functional as F
|
| 2 |
import torchvision.transforms.functional as TF
|
| 3 |
from transformers import AutoModel # trust_remote_code=True
|
|
@@ -211,6 +217,8 @@ def click_two_image_similarity(state1: dict, state2: dict, click_xy: tuple[int,
|
|
| 211 |
# ----------------------------
|
| 212 |
# Gradio UI
|
| 213 |
# ----------------------------
|
|
|
|
|
|
|
| 214 |
with gr.Blocks(theme=gr.themes.Soft(), title="DINOv3 Two‑Image Patch Similarity") as demo:
|
| 215 |
gr.Markdown("# DINOv3 Two‑Image Patch Similarity")
|
| 216 |
gr.Markdown("Upload two images, process, then click on image 1 to see similarities on both.")
|
|
@@ -234,4 +242,4 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DINOv3 Two‑Image Patch Similarit
|
|
| 234 |
# (rest of app: outputs, event wiring, functions, unchanged)
|
| 235 |
|
| 236 |
if __name__ == "__main__":
|
| 237 |
-
demo.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import numpy as np
|
| 3 |
+
from PIL import Image, ImageDraw
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
import torch.nn.functional as F
|
| 8 |
import torchvision.transforms.functional as TF
|
| 9 |
from transformers import AutoModel # trust_remote_code=True
|
|
|
|
| 217 |
# ----------------------------
|
| 218 |
# Gradio UI
|
| 219 |
# ----------------------------
|
| 220 |
+
|
| 221 |
+
|
| 222 |
with gr.Blocks(theme=gr.themes.Soft(), title="DINOv3 Two‑Image Patch Similarity") as demo:
|
| 223 |
gr.Markdown("# DINOv3 Two‑Image Patch Similarity")
|
| 224 |
gr.Markdown("Upload two images, process, then click on image 1 to see similarities on both.")
|
|
|
|
| 242 |
# (rest of app: outputs, event wiring, functions, unchanged)
|
| 243 |
|
| 244 |
if __name__ == "__main__":
|
| 245 |
+
demo.launch()
|