Jeffgold commited on
Commit
3aaf828
·
1 Parent(s): a56389b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -99,9 +99,15 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
99
 
100
  html = ""
101
  for path in output_paths:
102
- # Replace 'localhost' with your server's IP address if necessary
103
- html += f'<p><a href="http://localhost:5000/files/{path.name}" target="_blank">{path.stem}</a></p>'
104
- return html
 
 
 
 
 
 
105
 
106
  video_file = gr.inputs.File(label="Video File")
107
  quality = gr.inputs.Dropdown(
 
99
 
100
  html = ""
101
  for path in output_paths:
102
+ if path.suffix in ['.mp4', '.webm', '.ogg']:
103
+ html += f'<p><video width="320" height="240" controls><source src="http://localhost:5000/files/{path.name}" type="video/{path.suffix.lstrip('.')}">Your browser does not support the video tag.</video></p>'
104
+ elif path.suffix == '.txt':
105
+ with open(path, 'r') as file:
106
+ text_content = file.read()
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(