perler commited on
Commit
24154be
·
1 Parent(s): 6dbbf3c

can't find GPU -> try with extra function

Browse files
Files changed (2) hide show
  1. app.py +17 -13
  2. model.py +0 -2
app.py CHANGED
@@ -4,6 +4,7 @@ from __future__ import annotations
4
 
5
  import os
6
 
 
7
  import gradio as gr
8
 
9
  from model import Model
@@ -67,19 +68,22 @@ def main():
67
  ],
68
  cache_examples=False)
69
 
70
- run_button.click(fn=model.run,
71
- inputs=[
72
- input_shape,
73
- text,
74
- seed,
75
- guidance_scale,
76
- ],
77
- outputs=[
78
- viewpoint_images,
79
- result_3d_model,
80
- output_file,
81
- progress_text,
82
- ])
 
 
 
83
 
84
  demo.queue(max_size=5)
85
  demo.launch(debug=True)
 
4
 
5
  import os
6
 
7
+ import spaces
8
  import gradio as gr
9
 
10
  from model import Model
 
68
  ],
69
  cache_examples=False)
70
 
71
+ @spaces.GPU
72
+ def start_processing(): # extra function to use this decorator
73
+ run_button.click(fn=model.run,
74
+ inputs=[
75
+ input_shape,
76
+ text,
77
+ seed,
78
+ guidance_scale,
79
+ ],
80
+ outputs=[
81
+ viewpoint_images,
82
+ result_3d_model,
83
+ output_file,
84
+ progress_text,
85
+ ])
86
+ start_processing()
87
 
88
  demo.queue(max_size=5)
89
  demo.launch(debug=True)
model.py CHANGED
@@ -9,7 +9,6 @@ from typing import Generator, Optional
9
 
10
  import gradio as gr
11
  import trimesh
12
- import spaces
13
 
14
  sys.path.append('TEXTurePaper')
15
 
@@ -51,7 +50,6 @@ class Model:
51
  subprocess.run(shlex.split(f'zip -r {out_path} {mesh_dir}'))
52
  return out_path
53
 
54
- @spaces.GPU
55
  def run(
56
  self, shape_path: str, text: str, seed: int, guidance_scale: float
57
  ) -> Generator[tuple[list[str], Optional[str], Optional[str], str], None,
 
9
 
10
  import gradio as gr
11
  import trimesh
 
12
 
13
  sys.path.append('TEXTurePaper')
14
 
 
50
  subprocess.run(shlex.split(f'zip -r {out_path} {mesh_dir}'))
51
  return out_path
52
 
 
53
  def run(
54
  self, shape_path: str, text: str, seed: int, guidance_scale: float
55
  ) -> Generator[tuple[list[str], Optional[str], Optional[str], str], None,