Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 101 |
-
video_paths = []
|
| 102 |
-
text_contents = []
|
| 103 |
|
| 104 |
for path in output_paths:
|
| 105 |
-
|
| 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 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|