altryne commited on
Commit
805009b
·
unverified ·
1 Parent(s): 6472e1d

Ok fixed the gradio part

Browse files
Files changed (3) hide show
  1. app.py +3 -3
  2. download.py +1 -1
  3. requirements.txt +1 -1
app.py CHANGED
@@ -31,7 +31,7 @@ VIDEO_HTML = """
31
  preload="auto"
32
  width="640"
33
  height="264"
34
- data-setup='{}'>
35
  <source src="{src}" type="video/mp4">
36
  <track kind="captions" src="{en_vtt}" srclang="en" label="English" default>
37
  </video>
@@ -68,12 +68,12 @@ def predownload(url, translate_action, source_language):
68
  if 'srt_path' in response:
69
  files.append(response["srt_path"])
70
  if 'vtt_path' in response:
71
- files.append(response["srt_path"])
72
 
73
  if 'sub_video' in response:
74
  updates_object[sub_video] = gr.update(visible=True, value=response["sub_video"],
75
  label=f"Subbed video: {meta['id']}_translated.mp4")
76
- updates_object[sub_video_html] = gr.update(value=VIDEO_HTML.format(src=f"file={response['sub_video']}") )
77
  files.append(response["sub_video"])
78
 
79
  updates_object[output_file] = gr.update(value=files, visible=len(files) > 0, label=f"Output Files")
 
31
  preload="auto"
32
  width="640"
33
  height="264"
34
+ >
35
  <source src="{src}" type="video/mp4">
36
  <track kind="captions" src="{en_vtt}" srclang="en" label="English" default>
37
  </video>
 
68
  if 'srt_path' in response:
69
  files.append(response["srt_path"])
70
  if 'vtt_path' in response:
71
+ files.append(response["vtt_path"])
72
 
73
  if 'sub_video' in response:
74
  updates_object[sub_video] = gr.update(visible=True, value=response["sub_video"],
75
  label=f"Subbed video: {meta['id']}_translated.mp4")
76
+ updates_object[sub_video_html] = gr.update(value=VIDEO_HTML.format(src=f"file={response['sub_video']}", en_vtt=f"file={response['vtt_path']}") )
77
  files.append(response["sub_video"])
78
 
79
  updates_object[output_file] = gr.update(value=files, visible=len(files) > 0, label=f"Output Files")
download.py CHANGED
@@ -97,7 +97,7 @@ def download_generator(url, translate_action=True, source_language='Autodetect',
97
 
98
  fontsdir = Path('fonts')
99
  bake_subs(video, subbed_video_path.absolute() , srt_path.absolute(), fontsdir, translate_action)
100
- yield {"message": f"Subtitled video ready!", "sub_video": str(subbed_video_path.absolute()), "meta": meta}
101
  except ffmpeg.Error as e:
102
  print('stdout:', e.stdout.decode('utf8'))
103
  print('stderr:', e.stderr.decode('utf8'))
 
97
 
98
  fontsdir = Path('fonts')
99
  bake_subs(video, subbed_video_path.absolute() , srt_path.absolute(), fontsdir, translate_action)
100
+ yield {"message": f"Subtitled video ready!", "sub_video": str(subbed_video_path.absolute()), "meta": meta, "vtt_path": vtt_path}
101
  except ffmpeg.Error as e:
102
  print('stdout:', e.stdout.decode('utf8'))
103
  print('stderr:', e.stderr.decode('utf8'))
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
  youtube-dl==2021.12.17
2
  whisper @ git+https://github.com/openai/whisper.git@main#egg=whisper==1.1.6
3
  anvil-uplink==0.4.0
4
- gradio==3.4.0
5
  python-dotenv==0.21.0
6
  aiohttp==3.8.3
7
  aiohttp-requests==0.1.3
 
1
  youtube-dl==2021.12.17
2
  whisper @ git+https://github.com/openai/whisper.git@main#egg=whisper==1.1.6
3
  anvil-uplink==0.4.0
4
+ gradio==3.6
5
  python-dotenv==0.21.0
6
  aiohttp==3.8.3
7
  aiohttp-requests==0.1.3