File size: 1,104 Bytes
f559c43
 
 
fd6ec67
f559c43
fd6ec67
 
f559c43
fd6ec67
f559c43
fd6ec67
f559c43
fd6ec67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5faf826
f559c43
cb59257
866bc8b
fd6ec67
cb59257
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import subprocess
import sys

from DepthFlow.Webui import ESTIMATORS, UPSCALERS, DepthGradio

from Broken import Runtime
from Broken.Externals.Depthmap import DepthAnythingV2

# -----------------------------------------------|

if Runtime.ZeroGPU:

    # Install latest git main code
    for dependency in (
        "git+https://github.com/BrokenSource/BrokenSource@main",
        "git+https://github.com/BrokenSource/ShaderFlow@main",
        "git+https://github.com/BrokenSource/DepthFlow@main",
    ):
        subprocess.run((
            sys.executable, "-m", "uv", "pip", "install",
            dependency, "--upgrade",
        ))

    # Remove legacy upscalers
    UPSCALERS.pop("Real-ESRGAN")
    UPSCALERS.pop("Waifu2x")

    # Remove unsuitable models
    ESTIMATORS.clear()
    ESTIMATORS.update({
        # Base and Large models are CC BY-NC 4.0, better safe than sorry
        "DepthAnything2": DepthAnythingV2(model=DepthAnythingV2.Model.Small),
    })

# -----------------------------------------------|

DepthGradio().launch(
    workers=4,
    nvenc=True,
    turbo=True,
    pwa=True,
)