Spaces:
Running
on
Zero
Running
on
Zero
import os | |
import subprocess | |
import sys | |
import spaces | |
# Install latest git main code | |
bool(os.getenv("SPACES_ZERO_GPU")) and subprocess.run(( | |
sys.executable, "-m", "pip", "install", "--upgrade", | |
"git+https://github.com/BrokenSource/BrokenSource@main", | |
"git+https://github.com/BrokenSource/ShaderFlow@main", | |
"git+https://github.com/BrokenSource/DepthFlow@main", | |
)) | |
# -----------------------------------------------| | |
from DepthFlow.Webui import ESTIMATORS, UPSCALERS | |
from Broken.Externals.Depthmap import DepthAnythingV2 | |
# 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), | |
}) | |
# -----------------------------------------------| | |
from DepthFlow.Webui import DepthGradio | |
DepthGradio().launch( | |
workers=4, | |
nvenc=True, | |
turbo=True, | |
pwa=True, | |
) | |