haodongli commited on
Commit
515088a
1 Parent(s): 5a85e2a

update for zerogpu

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -43,6 +43,8 @@ def infer_video(path_input, seed):
43
  return [g_save_path, d_save_path]
44
 
45
  def run_demo_server():
 
 
46
  gradio_theme = gr.themes.Default()
47
 
48
  with gr.Blocks(
@@ -143,7 +145,7 @@ def run_demo_server():
143
  )
144
 
145
  gr.Examples(
146
- fn=infer,
147
  examples=sorted([
148
  [os.path.join("files", "images", name), 0]
149
  for name in os.listdir(os.path.join("files", "images"))
@@ -189,7 +191,7 @@ def run_demo_server():
189
  )
190
 
191
  gr.Examples(
192
- fn=infer_video,
193
  examples=sorted([
194
  [os.path.join("files", "videos", name), 0]
195
  for name in os.listdir(os.path.join("files", "videos"))
@@ -201,7 +203,7 @@ def run_demo_server():
201
 
202
  ### Image
203
  image_submit_btn.click(
204
- fn=infer,
205
  inputs=[image_input, seed],
206
  outputs=[image_output_g, image_output_d],
207
  )
@@ -214,7 +216,7 @@ def run_demo_server():
214
 
215
  ### Video
216
  video_submit_btn.click(
217
- fn=infer_video,
218
  inputs=[input_video, seed],
219
  outputs=[video_output_g, video_output_d],
220
  queue=True,
 
43
  return [g_save_path, d_save_path]
44
 
45
  def run_demo_server():
46
+ infer_gpu = spaces.GPU(functools.partial(infer))
47
+ infer_video_gpu = spaces.GPU(functools.partial(infer_video))
48
  gradio_theme = gr.themes.Default()
49
 
50
  with gr.Blocks(
 
145
  )
146
 
147
  gr.Examples(
148
+ fn=infer_gpu,
149
  examples=sorted([
150
  [os.path.join("files", "images", name), 0]
151
  for name in os.listdir(os.path.join("files", "images"))
 
191
  )
192
 
193
  gr.Examples(
194
+ fn=infer_video_gpu,
195
  examples=sorted([
196
  [os.path.join("files", "videos", name), 0]
197
  for name in os.listdir(os.path.join("files", "videos"))
 
203
 
204
  ### Image
205
  image_submit_btn.click(
206
+ fn=infer_gpu,
207
  inputs=[image_input, seed],
208
  outputs=[image_output_g, image_output_d],
209
  )
 
216
 
217
  ### Video
218
  video_submit_btn.click(
219
+ fn=infer_video_gpu,
220
  inputs=[input_video, seed],
221
  outputs=[video_output_g, video_output_d],
222
  queue=True,