Jeffgold commited on
Commit
afef060
·
1 Parent(s): 2535cc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -97,21 +97,23 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
97
  master_playlist_path = create_master_playlist(output_paths)
98
  output_paths.append(master_playlist_path)
99
 
100
- html_links = ""
101
- video_paths = []
102
- text_contents = []
103
 
104
  for path in output_paths:
105
- # Create download links
106
- html_links += f'<p><a href="http://localhost:5000/files/{path.name}" target="_blank">{path.stem}</a></p>'
107
-
108
  if path.suffix in ['.mp4', '.webm', '.ogg']:
109
- video_paths.append(f'http://localhost:5000/files/{path.name}')
110
- elif path.suffix == '.txt':
111
- with open(path, 'r') as file:
112
- text_contents.append(file.read())
 
 
 
 
 
 
 
113
 
114
- return html_links or "", video_paths or [""], text_contents or [""]
115
 
116
 
117
  video_file = gr.inputs.File(label="Video File")
 
97
  master_playlist_path = create_master_playlist(output_paths)
98
  output_paths.append(master_playlist_path)
99
 
100
+ html_components = []
 
 
101
 
102
  for path in output_paths:
103
+ # Create a video player and a download link for each video file
 
 
104
  if path.suffix in ['.mp4', '.webm', '.ogg']:
105
+ video_path = f'http://localhost:5000/files/{path.name}'
106
+ video_component = f'<video width="320" height="240" controls><source src="{video_path}" type="video/{path.suffix.lstrip('.')}">Your browser does not support the video tag.</video>'
107
+ download_link = f'<p><a href="{video_path}" download>Download this video</a></p>'
108
+ html_components.append(f'{video_component}{download_link}')
109
+
110
+ return html_components, # add more return values as needed
111
+
112
+ outputs = [
113
+ gr.outputs.HTML(label="Video Players", type="list"),
114
+ # add more outputs as needed
115
+ ]
116
 
 
117
 
118
 
119
  video_file = gr.inputs.File(label="Video File")