Spaces:
Runtime error
Runtime error
David Li commited on
Commit ·
b273369
1
Parent(s): ebe7599
fix: output
Browse files
app.py
CHANGED
|
@@ -135,14 +135,18 @@ 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
# return temp.mp4
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
print(words)
|
| 144 |
# get output_video as mp4
|
| 145 |
-
return result.get("segments"), words ,
|
| 146 |
|
| 147 |
gr.Interface(
|
| 148 |
title = 'Download Video From url and extract text from audio',
|
|
|
|
| 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 |
+
with open(output_file, "rb") as f:
|
| 146 |
+
output_bytes = f.read()
|
| 147 |
+
|
|
|
|
| 148 |
# get output_video as mp4
|
| 149 |
+
return result.get("segments"), words , output_bytes
|
| 150 |
|
| 151 |
gr.Interface(
|
| 152 |
title = 'Download Video From url and extract text from audio',
|