silentchen commited on
Commit
228fcc0
1 Parent(s): aa7e676

update space

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -14,6 +14,7 @@ import random
14
  import warnings
15
  from huggingface_hub import hf_hub_download
16
  import hashlib
 
17
 
18
  import sys
19
 
@@ -65,6 +66,9 @@ def optimize_all(xm, models, initial_noise, noise_start_t, diffusion, latent_mod
65
  edited_1, edited_2, edited_3, edited_4, state = _3d_editing(xm, models, diffusion, initial_noise, noise_start_t, device, instruction, rand_seed, state)
66
  print(state)
67
  return out_gen_1, out_gen_2, out_gen_3, out_gen_4, edited_1, edited_2, edited_3, edited_4
 
 
 
68
  @torch.no_grad()
69
  def generate_3d_with_shap_e(xm, diffusion, latent_model, device, prompt, rand_seed, state):
70
  set_seed(rand_seed)
@@ -119,6 +123,8 @@ def generate_3d_with_shap_e(xm, diffusion, latent_model, device, prompt, rand_se
119
  mesh_path.append(output_path_tmp)
120
  del latents
121
  return mesh_path[0], mesh_path[1], mesh_path[2], mesh_path[3], state
 
 
122
  @torch.no_grad()
123
  def _3d_editing(xm, models, diffusion, initial_noise, start_t, device, instruction, rand_seed, state):
124
  set_seed(rand_seed)
@@ -203,6 +209,7 @@ def _3d_editing(xm, models, diffusion, initial_noise, start_t, device, instructi
203
  mesh.export(output_path)
204
  mesh_path.append(output_path)
205
  return mesh_path[0], mesh_path[1], mesh_path[2], mesh_path[3], state
 
206
  def main():
207
 
208
  css = """
 
14
  import warnings
15
  from huggingface_hub import hf_hub_download
16
  import hashlib
17
+ import spaces
18
 
19
  import sys
20
 
 
66
  edited_1, edited_2, edited_3, edited_4, state = _3d_editing(xm, models, diffusion, initial_noise, noise_start_t, device, instruction, rand_seed, state)
67
  print(state)
68
  return out_gen_1, out_gen_2, out_gen_3, out_gen_4, edited_1, edited_2, edited_3, edited_4
69
+
70
+
71
+ @spaces.GPU()
72
  @torch.no_grad()
73
  def generate_3d_with_shap_e(xm, diffusion, latent_model, device, prompt, rand_seed, state):
74
  set_seed(rand_seed)
 
123
  mesh_path.append(output_path_tmp)
124
  del latents
125
  return mesh_path[0], mesh_path[1], mesh_path[2], mesh_path[3], state
126
+
127
+ @spaces.GPU()
128
  @torch.no_grad()
129
  def _3d_editing(xm, models, diffusion, initial_noise, start_t, device, instruction, rand_seed, state):
130
  set_seed(rand_seed)
 
209
  mesh.export(output_path)
210
  mesh_path.append(output_path)
211
  return mesh_path[0], mesh_path[1], mesh_path[2], mesh_path[3], state
212
+
213
  def main():
214
 
215
  css = """