freealise commited on
Commit
d5d810a
1 Parent(s): 845c174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -85,11 +85,6 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
85
  filenames = os.listdir(video_path)
86
  filenames = [os.path.join(video_path, filename) for filename in filenames if not filename.startswith('.')]
87
  filenames.sort()
88
-
89
- uploads = os.listdir("/tmp/gradio/")
90
- for k, ul in enumerate(uploads):
91
- print(ul)
92
- print(len(uploads))
93
 
94
  # os.makedirs(outdir, exist_ok=True)
95
 
@@ -345,6 +340,12 @@ with gr.Blocks(css=css) as demo:
345
 
346
  with gr.Row():
347
  with gr.Column():
 
 
 
 
 
 
348
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
349
  input_video = gr.Video(label="Input Video", format="mp4")
350
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
@@ -533,20 +534,21 @@ with gr.Blocks(css=css) as demo:
533
  <canvas id='cnv_out'/>""")
534
  render = gr.Button("Render")
535
 
536
- def on_submit(uploaded_video,model_type):
537
-
 
538
  # Process the video and get the path of the output video
539
  output_video_path = make_video(uploaded_video,encoder=model_type)
540
 
541
  return output_video_path
542
 
543
- submit.click(on_submit, inputs=[input_video, model_type], outputs=[processed_video, processed_zip, output_frame, output_depth])
544
  render.click(partial(get_mesh), inputs=[output_frame, output_depth, blur_in], outputs=[result])
545
 
546
  example_files = os.listdir('examples')
547
  example_files.sort()
548
- example_files = [[os.path.join('examples', filename), os.path.join('coords', filename+'.vtt')] for filename in example_files]
549
- examples = gr.Examples(examples=example_files, inputs=[input_video], outputs=[processed_video, processed_zip, output_frame, output_depth], fn=on_submit, cache_examples=True)
550
 
551
 
552
  if __name__ == '__main__':
 
85
  filenames = os.listdir(video_path)
86
  filenames = [os.path.join(video_path, filename) for filename in filenames if not filename.startswith('.')]
87
  filenames.sort()
 
 
 
 
 
88
 
89
  # os.makedirs(outdir, exist_ok=True)
90
 
 
340
 
341
  with gr.Row():
342
  with gr.Column():
343
+ coords = gr.Textbox(value="""50.07379596793083,14.437146122950555
344
+ 50.073799567020004,14.437146774240507
345
+ 50.07377647505558,14.437161000659017
346
+ 50.07379496839027,14.437148958238538
347
+ 50.073823157821664,14.437124189538856
348
+ """, label="Coordinates")
349
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
350
  input_video = gr.Video(label="Input Video", format="mp4")
351
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
 
534
  <canvas id='cnv_out'/>""")
535
  render = gr.Button("Render")
536
 
537
+ def on_submit(uploaded_video,model_type,coordinates):
538
+
539
+ print(coordinates)
540
  # Process the video and get the path of the output video
541
  output_video_path = make_video(uploaded_video,encoder=model_type)
542
 
543
  return output_video_path
544
 
545
+ submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_depth])
546
  render.click(partial(get_mesh), inputs=[output_frame, output_depth, blur_in], outputs=[result])
547
 
548
  example_files = os.listdir('examples')
549
  example_files.sort()
550
+ example_files = [os.path.join('examples', filename) for filename in example_files]
551
+ examples = gr.Examples(examples=example_files, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_depth], fn=on_submit, cache_examples=True)
552
 
553
 
554
  if __name__ == '__main__':