test
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import os
|
2 |
import subprocess
|
|
|
|
|
3 |
|
4 |
import matplotlib.pyplot as plt
|
5 |
import torch
|
@@ -87,11 +89,29 @@ model_option = gr.Radio(options, value="dino16",
|
|
87 |
label='Choose a backbone to upsample')
|
88 |
|
89 |
|
90 |
-
@spaces.GPU(120)
|
91 |
def upsample_features(image, model_option):
|
92 |
with torch.no_grad():
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
from featup.util import norm, unnorm
|
97 |
models = {o: torch.hub.load("mhamilton723/FeatUp", o) for o in options}
|
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
+
from setuptools import setup, find_packages
|
4 |
+
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension
|
5 |
|
6 |
import matplotlib.pyplot as plt
|
7 |
import torch
|
|
|
89 |
label='Choose a backbone to upsample')
|
90 |
|
91 |
|
92 |
+
@spaces.GPU(duration=120)
|
93 |
def upsample_features(image, model_option):
|
94 |
with torch.no_grad():
|
95 |
+
setup(
|
96 |
+
name='featup',
|
97 |
+
version='0.1.2',
|
98 |
+
packages=find_packages(),
|
99 |
+
ext_modules=[
|
100 |
+
CUDAExtension(
|
101 |
+
'adaptive_conv_cuda_impl',
|
102 |
+
[
|
103 |
+
'featup/adaptive_conv_cuda/adaptive_conv_cuda.cpp',
|
104 |
+
'featup/adaptive_conv_cuda/adaptive_conv_kernel.cu',
|
105 |
+
]),
|
106 |
+
CppExtension(
|
107 |
+
'adaptive_conv_cpp_impl',
|
108 |
+
['featup/adaptive_conv_cuda/adaptive_conv.cpp'],
|
109 |
+
undef_macros=["NDEBUG"]),
|
110 |
+
],
|
111 |
+
cmdclass={
|
112 |
+
'build_ext': BuildExtension
|
113 |
+
}
|
114 |
+
)
|
115 |
|
116 |
from featup.util import norm, unnorm
|
117 |
models = {o: torch.hub.load("mhamilton723/FeatUp", o) for o in options}
|