Spaces:
Running
on
Zero
Running
on
Zero
Tweaks models to serve on public space
Browse files
app.py
CHANGED
@@ -1,24 +1,42 @@
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
subprocess.run((
|
8 |
-
sys.executable, "-m", "pip", "install",
|
9 |
-
dependency, "--upgrade",
|
10 |
-
))
|
11 |
|
12 |
-
|
13 |
-
upgrade("git+https://github.com/BrokenSource/ShaderFlow@main")
|
14 |
-
upgrade("git+https://github.com/BrokenSource/DepthFlow@main")
|
15 |
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
DepthGradio().launch(
|
20 |
-
turbopipe=True,
|
21 |
workers=4,
|
22 |
nvenc=True,
|
|
|
23 |
pwa=True,
|
24 |
)
|
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
|
4 |
+
from DepthFlow.Webui import ESTIMATORS, UPSCALERS, DepthGradio
|
5 |
|
6 |
+
from Broken import Runtime
|
7 |
+
from Broken.Externals.Depthmap import DepthAnythingV2
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
# -----------------------------------------------|
|
|
|
|
|
10 |
|
11 |
+
if Runtime.ZeroGPU:
|
12 |
|
13 |
+
# Install latest git main code
|
14 |
+
for dependency in (
|
15 |
+
"git+https://github.com/BrokenSource/BrokenSource@main",
|
16 |
+
"git+https://github.com/BrokenSource/ShaderFlow@main",
|
17 |
+
"git+https://github.com/BrokenSource/DepthFlow@main",
|
18 |
+
):
|
19 |
+
subprocess.run((
|
20 |
+
sys.executable, "-m", "uv", "pip", "install",
|
21 |
+
dependency, "--upgrade",
|
22 |
+
))
|
23 |
+
|
24 |
+
# Remove legacy upscalers
|
25 |
+
UPSCALERS.pop("Real-ESRGAN")
|
26 |
+
UPSCALERS.pop("Waifu2x")
|
27 |
+
|
28 |
+
# Remove unsuitable models
|
29 |
+
ESTIMATORS.clear()
|
30 |
+
ESTIMATORS.update({
|
31 |
+
# Base and Large models are CC BY-NC 4.0, better safe than sorry
|
32 |
+
"DepthAnything2": DepthAnythingV2(model=DepthAnythingV2.Model.Small),
|
33 |
+
})
|
34 |
+
|
35 |
+
# -----------------------------------------------|
|
36 |
|
37 |
DepthGradio().launch(
|
|
|
38 |
workers=4,
|
39 |
nvenc=True,
|
40 |
+
turbo=True,
|
41 |
pwa=True,
|
42 |
)
|