FriendlyUser commited on
Commit
01d4c13
·
1 Parent(s): 1590dda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -135,15 +135,25 @@ def get_text_from_mp3_whisper(inputType:str, mp3_file: str, url_path: str, taskN
135
  f.write(words)
136
  print("done transcribing")
137
 
138
- output_file = "subtitled.mp4"
 
 
139
  try:
140
- result = run("ffmpeg -i temp.mp4 -vf subtitles=transcript.srt subtitled.mp4", stdout=PIPE, stderr=PIPE, universal_newlines=True)
 
 
 
 
 
 
 
141
  except Exception as e:
 
142
  print(e)
143
  output_file = "temp.mp4"
144
  # return temp.mp4
145
 
146
- return result.get("segments"), words, "subtitled.mp4"
147
 
148
  gr.Interface(
149
  title = 'Download Video From url and extract text from audio',
 
135
  f.write(words)
136
  print("done transcribing")
137
 
138
+ input_file = 'temp.mp4'
139
+ subtitles_file = 'transcript.srt'
140
+ output_file = 'subtitled.mp4'
141
  try:
142
+ print("attempt to output file")
143
+ (
144
+ ffmpeg
145
+ .input(input_file)
146
+ .filter('subtitles', subtitles_file)
147
+ .output(output_file)
148
+ .run()
149
+ )
150
  except Exception as e:
151
+ print("failed to output file")
152
  print(e)
153
  output_file = "temp.mp4"
154
  # return temp.mp4
155
 
156
+ return result.get("segments"), words, output_file
157
 
158
  gr.Interface(
159
  title = 'Download Video From url and extract text from audio',