Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ import imageio
|
|
11 |
import requests
|
12 |
import argparse
|
13 |
import imageio
|
|
|
14 |
from scipy.spatial.transform import Rotation
|
15 |
|
16 |
from gradio_draggable import Draggable
|
@@ -105,7 +106,8 @@ def objs_to_canvas(lst, length=256, scale = 2.6):
|
|
105 |
canvas[mask] = feat
|
106 |
canvas = np.transpose(canvas, [2, 0, 1]).astype(np.float32)
|
107 |
return canvas
|
108 |
-
|
|
|
109 |
@torch.no_grad()
|
110 |
def predict_local_view(lst):
|
111 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|
@@ -115,6 +117,7 @@ def predict_local_view(lst):
|
|
115 |
rgb = gen['gen_output']['image'][0] * .5 + .5
|
116 |
return to_pil(rgb)
|
117 |
|
|
|
118 |
@torch.no_grad()
|
119 |
def predict_local_view_video(lst):
|
120 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|
@@ -140,6 +143,7 @@ def predict_local_view_video(lst):
|
|
140 |
writer.close()
|
141 |
return 'tmp.mp4'
|
142 |
|
|
|
143 |
@torch.no_grad()
|
144 |
def predict_global_view(lst):
|
145 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|
|
|
11 |
import requests
|
12 |
import argparse
|
13 |
import imageio
|
14 |
+
import spaces
|
15 |
from scipy.spatial.transform import Rotation
|
16 |
|
17 |
from gradio_draggable import Draggable
|
|
|
106 |
canvas[mask] = feat
|
107 |
canvas = np.transpose(canvas, [2, 0, 1]).astype(np.float32)
|
108 |
return canvas
|
109 |
+
|
110 |
+
@spaces.GPU
|
111 |
@torch.no_grad()
|
112 |
def predict_local_view(lst):
|
113 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|
|
|
117 |
rgb = gen['gen_output']['image'][0] * .5 + .5
|
118 |
return to_pil(rgb)
|
119 |
|
120 |
+
@spaces.GPU
|
121 |
@torch.no_grad()
|
122 |
def predict_local_view_video(lst):
|
123 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|
|
|
143 |
writer.close()
|
144 |
return 'tmp.mp4'
|
145 |
|
146 |
+
@spaces.GPU
|
147 |
@torch.no_grad()
|
148 |
def predict_global_view(lst):
|
149 |
canvas = torch.tensor(objs_to_canvas(lst)).cuda()[None]
|