Spaces:
Sleeping
Sleeping
update tab order and remove transcript sorter as a better version exists in fileConvertor app.
Browse files
app.py
CHANGED
|
@@ -198,6 +198,34 @@ def convert_video(input_file, output_format):
|
|
| 198 |
except Exception as e:
|
| 199 |
return f"Error: {str(e)}"
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
# gr components for video trimmer with random start
|
| 202 |
input_file_vtr = gr.File(label="Select video file")
|
| 203 |
output_format_vtr = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4", )
|
|
@@ -231,30 +259,5 @@ interface_wt = gr.Interface(fn=trim_video_wt, inputs=[input_file_wt, input_trans
|
|
| 231 |
`Annotations`: a string that may be blank, representing any annotations for the utterance. \n\
|
| 232 |
`Error Type`: a string that may be blank, representing any errors in the transcription of the utterance. ")
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
output_format = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4", )
|
| 237 |
-
start_time = gr.Textbox(label="Start time (in seconds or HH:MM:SS). Leave blank to start at beginning.")
|
| 238 |
-
end_time = gr.Textbox(label="End time (in seconds or HH:MM:SS). Leave blank to trim a 5-minute interval since start.")
|
| 239 |
-
output_file = gr.File(label="Download trimmed file")
|
| 240 |
-
interface = gr.Interface(fn=trim_video, inputs=[input_file, output_format, start_time, end_time], outputs=output_file, title="Video Trimmer", allow_flagging="never",
|
| 241 |
-
description="Trim a video file to a specific time interval. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 242 |
-
|
| 243 |
-
# gr components for video converter
|
| 244 |
-
input_file_c = gr.File(label="Select video file")
|
| 245 |
-
output_format_c = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4",)
|
| 246 |
-
output_file_c = gr.File(label="Download converted file")
|
| 247 |
-
|
| 248 |
-
interface_c = gr.Interface(fn=convert_video, inputs=[input_file_c, output_format_c], outputs=output_file_c, title="Video Converter", allow_flagging="never",
|
| 249 |
-
description="Convert a video file to a different format. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
# gr components for transcript sorter
|
| 253 |
-
input_file_s = gr.File(label="Select transcript file")
|
| 254 |
-
output_file_s = gr.File(label="Download sorted transcript")
|
| 255 |
-
interface_s = gr.Interface(fn=sort_transcript_wrapper, inputs=input_file_s, outputs=output_file_s, title="Transcript Sorter", allow_flagging="never",
|
| 256 |
-
description="Sort a transcript file by time. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
demo = gr.TabbedInterface([interface_vtr, interface_wt, interface, interface_c, interface_s], ["Video Trimmer with Random Start Time", "Video Trimmer with Transcript", "Video Trimmer", "Video Converter", "Transcript Sorter"])
|
| 260 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 198 |
except Exception as e:
|
| 199 |
return f"Error: {str(e)}"
|
| 200 |
|
| 201 |
+
|
| 202 |
+
# gr components for video trimmer
|
| 203 |
+
input_file = gr.File(label="Select video file")
|
| 204 |
+
output_format = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4", )
|
| 205 |
+
start_time = gr.Textbox(label="Start time (in seconds or HH:MM:SS). Leave blank to start at beginning.")
|
| 206 |
+
end_time = gr.Textbox(label="End time (in seconds or HH:MM:SS). Leave blank to trim a 5-minute interval since start.")
|
| 207 |
+
output_file = gr.File(label="Download trimmed file")
|
| 208 |
+
interface = gr.Interface(fn=trim_video, inputs=[input_file, output_format, start_time, end_time], outputs=output_file, title="Video Trimmer", allow_flagging="never",
|
| 209 |
+
description="Trim a video file to a specific time interval. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 210 |
+
|
| 211 |
+
# gr components for video converter
|
| 212 |
+
input_file_c = gr.File(label="Select video file")
|
| 213 |
+
output_format_c = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4",)
|
| 214 |
+
output_file_c = gr.File(label="Download converted file")
|
| 215 |
+
|
| 216 |
+
interface_c = gr.Interface(fn=convert_video, inputs=[input_file_c, output_format_c], outputs=output_file_c, title="Video Converter", allow_flagging="never",
|
| 217 |
+
description="Convert a video file to a different format. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
# gr components for transcript sorter
|
| 221 |
+
input_file_s = gr.File(label="Select transcript file")
|
| 222 |
+
output_file_s = gr.File(label="Download sorted transcript")
|
| 223 |
+
interface_s = gr.Interface(fn=sort_transcript_wrapper, inputs=input_file_s, outputs=output_file_s, title="Transcript Sorter", allow_flagging="never",
|
| 224 |
+
description="Sort a transcript file by time. Please wait for the file to upload before clicking the 'Submit' button.")
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
|
| 229 |
# gr components for video trimmer with random start
|
| 230 |
input_file_vtr = gr.File(label="Select video file")
|
| 231 |
output_format_vtr = gr.Dropdown(choices=["mkv", "MOV", "mp4", "wav"], label="Select output format", value="mp4", )
|
|
|
|
| 259 |
`Annotations`: a string that may be blank, representing any annotations for the utterance. \n\
|
| 260 |
`Error Type`: a string that may be blank, representing any errors in the transcription of the utterance. ")
|
| 261 |
|
| 262 |
+
demo = gr.TabbedInterface([interface_c, interface, interface_vtr, interface_wt ], ["Video Converter", "Video Trimmer", "Video Trimmer with Random Start Time", "Video Trimmer with Transcript"])
|
| 263 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|