Epoching commited on
Commit
6112c19
1 Parent(s): 0b9f920

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -48,7 +48,7 @@ from pathlib import Path
48
  import shutil
49
  from time import sleep
50
 
51
- def inpaint(img_name, num_frames, fps, traj_type):
52
 
53
  print(traj_type)
54
 
@@ -187,7 +187,7 @@ def resizer(input_img, max_img_size=512):
187
  else:
188
  return input_img
189
 
190
- def main_app(input_img, num_frames, fps, traj_type):
191
 
192
  # Save image in necessary folder for inpainting
193
  img_name = Path(str(uuid.uuid4()) + '.jpg')
@@ -196,7 +196,7 @@ def main_app(input_img, num_frames, fps, traj_type):
196
  input_img = resizer(input_img)
197
  input_img.save(save_folder/img_name)
198
 
199
- inpaint(img_name, num_frames, fps, traj_type)
200
 
201
  #subprocess.run('ls -l', shell=True)
202
  #subprocess.run('ls image -l', shell=True)
@@ -211,13 +211,12 @@ def main_app(input_img, num_frames, fps, traj_type):
211
  video_choices = ['dolly-zoom-in', 'zoom-in', 'circle', 'swing']
212
  gradio_inputs = [gr.inputs.Image(type='pil', label='Input Image'),
213
  gr.inputs.Slider(minimum=60, maximum=240, step=1, default=120, label="Number of Frames"),
214
- gr.inputs.Slider(minimum=10, maximum=40, step=1, default=20, label="Frames per Second (FPS)"),
215
- gr.inputs.Radio(choices=video_choices, default='circle', label='(Work-in-progress) What type of 3D video do you want?')]
216
 
217
  gradio_outputs = [gr.outputs.Video(label='Output Video')]
218
  examples = [ ['moon.jpg'], ['dog.jpg'] ]
219
 
220
- description="Convert an image into a trajectory-following video. Images are automatically resized down to a max edge of 512. | NOTE: The current runtime for a sample is around 400-700 seconds. Running on a lower number of frames could help! Do be patient as this is on CPU-only, BUT if this space maybe gets a GPU one day, it's already configured to run with GPU-support :) If you have a GPU, feel free to use the author's original repo, or just `git clone https://huggingface.co/spaces/Classified/3D_Photo_Inpainting`, install packages and requirements, then `python app.py` to run the gradio GUI locally!"
221
 
222
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2004.04727' target='_blank'>3D Photography using Context-aware Layered Depth Inpainting</a> | <a href='https://shihmengli.github.io/3D-Photo-Inpainting/' target='_blank'>Github Project Page</a> | <a href='https://github.com/vt-vl-lab/3d-photo-inpainting' target='_blank'>Github Repo</a></p>"
223
 
 
48
  import shutil
49
  from time import sleep
50
 
51
+ def inpaint(img_name, num_frames, fps):
52
 
53
  print(traj_type)
54
 
 
187
  else:
188
  return input_img
189
 
190
+ def main_app(input_img, num_frames, fps):
191
 
192
  # Save image in necessary folder for inpainting
193
  img_name = Path(str(uuid.uuid4()) + '.jpg')
 
196
  input_img = resizer(input_img)
197
  input_img.save(save_folder/img_name)
198
 
199
+ inpaint(img_name, num_frames, fps)
200
 
201
  #subprocess.run('ls -l', shell=True)
202
  #subprocess.run('ls image -l', shell=True)
 
211
  video_choices = ['dolly-zoom-in', 'zoom-in', 'circle', 'swing']
212
  gradio_inputs = [gr.inputs.Image(type='pil', label='Input Image'),
213
  gr.inputs.Slider(minimum=60, maximum=240, step=1, default=120, label="Number of Frames"),
214
+ gr.inputs.Slider(minimum=10, maximum=40, step=1, default=20, label="Frames per Second (FPS)")]
 
215
 
216
  gradio_outputs = [gr.outputs.Video(label='Output Video')]
217
  examples = [ ['moon.jpg'], ['dog.jpg'] ]
218
 
219
+ description="Convert an image into a trajectory-following video. Images are automatically resized down to a max edge of 512. | NOTE: The current runtime for a sample is around 400-700 seconds. Running on a lower number of frames could help! Do be patient as this is on CPU-only, BUT if this space maybe gets a GPU one day, it's already configured to run with GPU-support :) If you have a GPU, feel free to use the author's original repo, or just `git clone https://huggingface.co/spaces/Epoching/3D_Photo_Inpainting`, install packages and requirements, then `python app.py` to run the gradio GUI locally!"
220
 
221
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2004.04727' target='_blank'>3D Photography using Context-aware Layered Depth Inpainting</a> | <a href='https://shihmengli.github.io/3D-Photo-Inpainting/' target='_blank'>Github Project Page</a> | <a href='https://github.com/vt-vl-lab/3d-photo-inpainting' target='_blank'>Github Repo</a></p>"
222