Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -97,17 +97,21 @@ 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 |
for path in output_paths:
|
|
|
|
|
|
|
102 |
if path.suffix in ['.mp4', '.webm', '.ogg']:
|
103 |
-
|
104 |
elif path.suffix == '.txt':
|
105 |
with open(path, 'r') as file:
|
106 |
-
|
107 |
-
html += f'<p><textarea rows="4" cols="50">{text_content}</textarea></p>'
|
108 |
-
else:
|
109 |
-
html += f'<p><a href="http://localhost:5000/files/{path.name}" download="{path.name}" target="_blank">{path.stem}</a></p>'
|
110 |
|
|
|
111 |
|
112 |
video_file = gr.inputs.File(label="Video File")
|
113 |
quality = gr.inputs.Dropdown(
|
@@ -123,7 +127,11 @@ aspect_ratio = gr.inputs.Dropdown(
|
|
123 |
standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
|
124 |
video_url = gr.inputs.Textbox(label="Or enter video URL")
|
125 |
|
126 |
-
outputs =
|
|
|
|
|
|
|
|
|
127 |
|
128 |
interface = gr.Interface(
|
129 |
fn=convert_video,
|
@@ -135,4 +143,4 @@ interface = gr.Interface(
|
|
135 |
server_name="0.0.0.0",
|
136 |
server_port=7860,
|
137 |
)
|
138 |
-
interface.launch()
|
|
|
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, video_paths, text_contents
|
115 |
|
116 |
video_file = gr.inputs.File(label="Video File")
|
117 |
quality = gr.inputs.Dropdown(
|
|
|
127 |
standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
|
128 |
video_url = gr.inputs.Textbox(label="Or enter video URL")
|
129 |
|
130 |
+
outputs = [
|
131 |
+
gr.outputs.HTML(label="Download Links"),
|
132 |
+
gr.outputs.Video(label="Video Player", type="list"),
|
133 |
+
gr.outputs.Textbox(label="Text Files", type="list")
|
134 |
+
]
|
135 |
|
136 |
interface = gr.Interface(
|
137 |
fn=convert_video,
|
|
|
143 |
server_name="0.0.0.0",
|
144 |
server_port=7860,
|
145 |
)
|
146 |
+
interface.launch()
|