Spaces:
Running
Running
deps: drop gradio from requirements (let SDK manage), CPU torch, transformers>=4.53; add startup prints
Browse files- app.py +5 -1
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -3,13 +3,16 @@ DINO Hierarchies — upload an image, get its condensed tree (hover) + reveal an
|
|
| 3 |
Runs DINOv3 ViT-L/16, builds the same condensed tree we precomputed for the static site,
|
| 4 |
and injects it into the existing JS widgets (no server-side rendering of the video).
|
| 5 |
"""
|
| 6 |
-
import os, io, json, html, base64
|
|
|
|
| 7 |
import numpy as np, torch
|
| 8 |
try:
|
| 9 |
import gradio as gr
|
|
|
|
| 10 |
except ImportError:
|
| 11 |
gr = None # allows importing the pipeline without gradio (local testing)
|
| 12 |
from PIL import Image
|
|
|
|
| 13 |
from scipy.cluster.hierarchy import linkage, to_tree
|
| 14 |
from scipy.spatial.distance import squareform
|
| 15 |
from transformers import AutoModel
|
|
@@ -117,4 +120,5 @@ if gr is not None:
|
|
| 117 |
btn.click(process, inp, [out_tree, out_rev])
|
| 118 |
inp.upload(process, inp, [out_tree, out_rev])
|
| 119 |
|
|
|
|
| 120 |
demo.queue().launch() # module-level: HF Spaces imports this file, so no __main__ guard
|
|
|
|
| 3 |
Runs DINOv3 ViT-L/16, builds the same condensed tree we precomputed for the static site,
|
| 4 |
and injects it into the existing JS widgets (no server-side rendering of the video).
|
| 5 |
"""
|
| 6 |
+
import os, io, json, html, base64, sys
|
| 7 |
+
print("[app] starting import", flush=True)
|
| 8 |
import numpy as np, torch
|
| 9 |
try:
|
| 10 |
import gradio as gr
|
| 11 |
+
print("[app] gradio", gr.__version__, flush=True)
|
| 12 |
except ImportError:
|
| 13 |
gr = None # allows importing the pipeline without gradio (local testing)
|
| 14 |
from PIL import Image
|
| 15 |
+
print("[app] transformers import...", flush=True)
|
| 16 |
from scipy.cluster.hierarchy import linkage, to_tree
|
| 17 |
from scipy.spatial.distance import squareform
|
| 18 |
from transformers import AutoModel
|
|
|
|
| 120 |
btn.click(process, inp, [out_tree, out_rev])
|
| 121 |
inp.upload(process, inp, [out_tree, out_rev])
|
| 122 |
|
| 123 |
+
print("[app] launching gradio", flush=True)
|
| 124 |
demo.queue().launch() # module-level: HF Spaces imports this file, so no __main__ guard
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
|
|
| 1 |
torch
|
| 2 |
-
transformers>=4.
|
| 3 |
scipy
|
| 4 |
pillow
|
| 5 |
numpy
|
| 6 |
-
gradio>=4.44
|
|
|
|
| 1 |
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
| 2 |
torch
|
| 3 |
+
transformers>=4.53
|
| 4 |
scipy
|
| 5 |
pillow
|
| 6 |
numpy
|
|
|