Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- app.py +0 -12
- requirements.txt +25 -22
- upsampler_theme.py +0 -54
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
title: SeedVR2 3B Image Upscaler
|
| 3 |
emoji: 🔍
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.49.1
|
|
|
|
| 1 |
---
|
| 2 |
title: SeedVR2 3B Image Upscaler
|
| 3 |
emoji: 🔍
|
| 4 |
+
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.49.1
|
app.py
CHANGED
|
@@ -36,18 +36,6 @@ os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
|
|
| 36 |
|
| 37 |
import gc
|
| 38 |
|
| 39 |
-
# --- PINDUMP (temporary, per hf-spaces/README.md step 2) ------------------
|
| 40 |
-
import importlib.metadata as _ilm
|
| 41 |
-
for _pkg in ["torch", "torchvision", "torchaudio", "numpy", "scipy", "diffusers",
|
| 42 |
-
"transformers", "accelerate", "safetensors", "huggingface_hub",
|
| 43 |
-
"omegaconf", "einops", "rotary-embedding-torch", "imageio",
|
| 44 |
-
"imageio-ffmpeg", "opencv-python-headless", "Pillow", "tqdm",
|
| 45 |
-
"sentencepiece", "torchao"]:
|
| 46 |
-
try:
|
| 47 |
-
print(f"PINDUMP {_pkg}=={_ilm.version(_pkg)}", flush=True)
|
| 48 |
-
except Exception:
|
| 49 |
-
pass
|
| 50 |
-
# -------------------------------------------------------------------------
|
| 51 |
import mimetypes
|
| 52 |
from pathlib import Path
|
| 53 |
|
|
|
|
| 36 |
|
| 37 |
import gc
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
import mimetypes
|
| 40 |
from pathlib import Path
|
| 41 |
|
requirements.txt
CHANGED
|
@@ -1,26 +1,29 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
|
|
|
|
|
|
| 3 |
#
|
| 4 |
# gradio and spaces are deliberately absent: the platform pins them, and a
|
| 5 |
# competing pin here breaks resolution or the ZeroGPU runtime.
|
| 6 |
#
|
| 7 |
-
# torch is
|
| 8 |
-
# support (2.8.0+ only) and which was the
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
| 1 |
+
# Exact pins harvested from the running Space (PINDUMP, per hf-spaces/README.md
|
| 2 |
+
# step 2). Frozen because an unpinned dep already cost us a working Space once:
|
| 3 |
+
# torchao drifted to 0.18.0 on the ltx-2-5 Space and broke ZeroGPU's weight
|
| 4 |
+
# packing on code that had been verified working.
|
| 5 |
#
|
| 6 |
# gradio and spaces are deliberately absent: the platform pins them, and a
|
| 7 |
# competing pin here breaks resolution or the ZeroGPU runtime.
|
| 8 |
#
|
| 9 |
+
# torch is pinned to what the runtime actually installed. Upstream pinned
|
| 10 |
+
# torch==2.4.0, which ZeroGPU does not support (2.8.0+ only) and which was the
|
| 11 |
+
# root cause of the upstream Space being broken.
|
| 12 |
+
torch==2.11.0
|
| 13 |
+
torchvision==0.26.0
|
| 14 |
+
diffusers==0.39.0
|
| 15 |
+
transformers==5.15.0
|
| 16 |
+
accelerate==1.14.0
|
| 17 |
+
safetensors==0.8.0
|
| 18 |
+
huggingface_hub==1.16.1
|
| 19 |
+
sentencepiece==0.2.2
|
| 20 |
+
omegaconf==2.3.1
|
| 21 |
+
einops==0.8.2
|
| 22 |
+
rotary-embedding-torch==0.9.1
|
| 23 |
+
opencv-python-headless==5.0.0.93
|
| 24 |
+
imageio==2.37.4
|
| 25 |
+
imageio-ffmpeg==0.6.0
|
| 26 |
+
Pillow==11.3.0
|
| 27 |
+
numpy==2.2.6
|
| 28 |
+
scipy==1.15.3
|
| 29 |
+
tqdm==4.70.0
|
upsampler_theme.py
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
"""Shared Upsampler look-and-feel for every Upsampler/* HF Space.
|
| 2 |
-
|
| 3 |
-
`create_and_push.py` uploads this file alongside each Space's app.py, so every
|
| 4 |
-
Space imports the exact same theme, CSS, header, and footer. Keep this the
|
| 5 |
-
single source of truth (v3 recipe): Soft indigo/purple theme, gradient primary
|
| 6 |
-
button, Gradio's own footer hidden, 1000px max width, minimal header/footer.
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
import gradio as gr
|
| 10 |
-
|
| 11 |
-
UPSAMPLER_THEME = gr.themes.Soft(
|
| 12 |
-
primary_hue=gr.themes.colors.indigo,
|
| 13 |
-
secondary_hue=gr.themes.colors.purple,
|
| 14 |
-
neutral_hue=gr.themes.colors.slate,
|
| 15 |
-
font=[gr.themes.GoogleFont("Inter"), "system-ui", "sans-serif"],
|
| 16 |
-
).set(
|
| 17 |
-
button_primary_background_fill="linear-gradient(90deg, #6366f1 0%, #a855f7 100%)",
|
| 18 |
-
button_primary_background_fill_hover="linear-gradient(90deg, #4f46e5 0%, #9333ea 100%)",
|
| 19 |
-
button_primary_text_color="#ffffff",
|
| 20 |
-
button_primary_border_color="*primary_500",
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
# Hide Gradio's built-in footer and keep the app narrow and centered.
|
| 24 |
-
UPSAMPLER_CSS = """
|
| 25 |
-
footer { display: none !important; }
|
| 26 |
-
.gradio-container { max-width: 1000px !important; margin: 0 auto !important; }
|
| 27 |
-
#usp-header h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 .25rem; }
|
| 28 |
-
#usp-header p { opacity: .6; margin: 0; }
|
| 29 |
-
#usp-footer { opacity: .5; font-size: .85rem; margin-top: 1.25rem; }
|
| 30 |
-
#usp-footer a { text-decoration: none; }
|
| 31 |
-
"""
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
def header_html(title: str, subtitle: str) -> str:
|
| 35 |
-
return f"""<div id="usp-header">
|
| 36 |
-
<h1>{title}</h1>
|
| 37 |
-
<p>{subtitle}</p>
|
| 38 |
-
</div>"""
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
_LINK_STYLE = "color:#8b7cf6;font-weight:600;text-decoration:none"
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
def footer_html(description: str, tool_url: str, tool_anchor: str) -> str:
|
| 45 |
-
"""SEO footer (v4 recipe): a short paragraph describing what the model
|
| 46 |
-
does (unique per Space, keyword-bearing) plus the Upsampler attribution
|
| 47 |
-
with a deep link to the matching /free-* tool on upsampler.com. No model
|
| 48 |
-
credit/license line (the README frontmatter carries the license). Spaces
|
| 49 |
-
target model-name queries; the site pages keep the intent queries
|
| 50 |
-
("free X no signup"), so the two never compete."""
|
| 51 |
-
return f"""<div id="usp-footer">
|
| 52 |
-
<p style="margin:0 0 10px">{description}</p>
|
| 53 |
-
<p style="margin:0">Maintained by <a href="https://upsampler.com" target="_blank" rel="noopener" style="{_LINK_STYLE}">Upsampler</a>. Check out the <a href="{tool_url}" target="_blank" rel="noopener" style="{_LINK_STYLE}">{tool_anchor}</a>, no sign-up required.</p>
|
| 54 |
-
</div>"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|