I need to display Video with subtitles.
I download the video, and have valid subtitle srt file. Below code works good on my laptop, and google colab, errors out in huggingface spaces.
I wrote a valid srt file youtube_shorts_lmHXC-Y9Veg_subtitles.srt. However, it appears spaces is looking for tmpe4iw08t4.vtt which it cannot find.
Looking for pointers to make this work on spaces
Code
video = gr.Video(
include_audio=True,
interactive=False,
visible=True,
show_download_button=True,
value=(downloaded_video, subtitles_srt_file)
)
Stack trace
Writing youtube_shorts_lmHXC-Y9Veg_subtitles.srt
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 528, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 270, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1918, in process_api
data = await self.postprocess_data(fn_index, result["prediction"], state)
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1732, in postprocess_data
prediction_value = postprocess_update_dict(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 605, in postprocess_update_dict
update_dict["value"] = block.postprocess(value)
File "/usr/local/lib/python3.10/site-packages/gradio/components/video.py", line 260, in postprocess
self._format_subtitle(subtitle),
File "/usr/local/lib/python3.10/site-packages/gradio/components/video.py", line 349, in _format_subtitle
temp_file = tempfile.NamedTemporaryFile(
File "/usr/local/lib/python3.10/tempfile.py", line 575, in NamedTemporaryFile
file = _io.open(dir, mode, buffering=buffering,
File "/usr/local/lib/python3.10/tempfile.py", line 572, in opener
fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/usr/local/lib/python3.10/tempfile.py", line 256, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/gradio/tmpe4iw08t4.vtt'