cbensimon HF staff commited on
Commit
6cdea50
1 Parent(s): ffcbbc8

By wrapping GPU functions like this the pipeline doesn't have to be transferred from the main process to the GPU worker and GPU coldstart should be much faster (measured between 3s and 4s on this Space)

Files changed (1) hide show
  1. app.py 3 -6
app.py CHANGED
@@ -46,7 46,6 @@ default_bas_frame_near = 1
46
  default_bas_frame_far = 1
47
 
48
 
49
- @spaces.GPU
50
  def process_image(
51
  pipe,
52
  path_input,
@@ -89,7 88,6 @@ def process_image(
89
  )
90
 
91
 
92
- @spaces.GPU
93
  def process_video(
94
  pipe,
95
  path_input,
@@ -187,7 185,6 @@ def process_video(
187
  )
188
 
189
 
190
- @spaces.GPU
191
  def process_bas(
192
  pipe,
193
  path_input,
@@ -282,9 279,9 @@ def process_bas(
282
 
283
 
284
  def run_demo_server(pipe):
285
- process_pipe_image = functools.partial(process_image, pipe)
286
- process_pipe_video = functools.partial(process_video, pipe)
287
- process_pipe_bas = functools.partial(process_bas, pipe)
288
  os.environ["GRADIO_ALLOW_FLAGGING"] = "never"
289
 
290
  gradio_theme = gr.themes.Default()
 
46
  default_bas_frame_far = 1
47
 
48
 
 
49
  def process_image(
50
  pipe,
51
  path_input,
 
88
  )
89
 
90
 
 
91
  def process_video(
92
  pipe,
93
  path_input,
 
185
  )
186
 
187
 
 
188
  def process_bas(
189
  pipe,
190
  path_input,
 
279
 
280
 
281
  def run_demo_server(pipe):
282
process_pipe_image = spaces.GPU(functools.partial(process_image, pipe))
283
process_pipe_video = spaces.GPU(functools.partial(process_video, pipe))
284
process_pipe_bas = spaces.GPU(functools.partial(process_bas, pipe))
285
  os.environ["GRADIO_ALLOW_FLAGGING"] = "never"
286
 
287
  gradio_theme = gr.themes.Default()