haodongli commited on
Commit
e8956e4
1 Parent(s): 5f0fce1
Files changed (2) hide show
  1. app.py +6 -6
  2. files/images/02.jpg +0 -0
app.py CHANGED
@@ -17,7 +17,7 @@ from infer import lotus, lotus_video
17
 
18
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
19
 
20
- def infer(path_input, seed=0):
21
  name_base, name_ext = os.path.splitext(os.path.basename(path_input))
22
  output_g, output_d = lotus(path_input, 'normal', seed, device)
23
  if not os.path.exists("files/output"):
@@ -28,7 +28,7 @@ def infer(path_input, seed=0):
28
  output_d.save(d_save_path)
29
  return [path_input, g_save_path], [path_input, d_save_path]
30
 
31
- def infer_video(path_input, seed=0):
32
  frames_g, frames_d = lotus_video(path_input, 'normal', seed, device)
33
  if not os.path.exists("files/output"):
34
  os.makedirs("files/output")
@@ -142,10 +142,10 @@ def run_demo_server():
142
  gr.Examples(
143
  fn=infer,
144
  examples=sorted([
145
- os.path.join("files", "images", name)
146
  for name in os.listdir(os.path.join("files", "images"))
147
  ]),
148
- inputs=[image_input],
149
  outputs=[image_output_g, image_output_d],
150
  cache_examples=True,
151
  )
@@ -188,10 +188,10 @@ def run_demo_server():
188
  gr.Examples(
189
  fn=infer_video,
190
  examples=sorted([
191
- os.path.join("files", "videos", name)
192
  for name in os.listdir(os.path.join("files", "videos"))
193
  ]),
194
- inputs=[input_video],
195
  outputs=[video_output_g, video_output_d],
196
  cache_examples=True,
197
  )
 
17
 
18
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
19
 
20
+ def infer(path_input, seed):
21
  name_base, name_ext = os.path.splitext(os.path.basename(path_input))
22
  output_g, output_d = lotus(path_input, 'normal', seed, device)
23
  if not os.path.exists("files/output"):
 
28
  output_d.save(d_save_path)
29
  return [path_input, g_save_path], [path_input, d_save_path]
30
 
31
+ def infer_video(path_input, seed):
32
  frames_g, frames_d = lotus_video(path_input, 'normal', seed, device)
33
  if not os.path.exists("files/output"):
34
  os.makedirs("files/output")
 
142
  gr.Examples(
143
  fn=infer,
144
  examples=sorted([
145
+ [os.path.join("files", "images", name), 0]
146
  for name in os.listdir(os.path.join("files", "images"))
147
  ]),
148
+ inputs=[image_input, seed],
149
  outputs=[image_output_g, image_output_d],
150
  cache_examples=True,
151
  )
 
188
  gr.Examples(
189
  fn=infer_video,
190
  examples=sorted([
191
+ [os.path.join("files", "videos", name), 0]
192
  for name in os.listdir(os.path.join("files", "videos"))
193
  ]),
194
+ inputs=[input_video, seed],
195
  outputs=[video_output_g, video_output_d],
196
  cache_examples=True,
197
  )
files/images/02.jpg CHANGED