Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,8 +115,10 @@ def generate_subtitle_file(language, segments, input_video_name):
|
|
| 115 |
f.close()
|
| 116 |
return subtitle_file
|
| 117 |
|
| 118 |
-
def transcribe(
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
print("transcribe")
|
| 121 |
wordlevel_info=word_level_transcribe(mp3_file)
|
| 122 |
subtitles = create_subtitles(wordlevel_info)
|
|
@@ -126,13 +128,14 @@ def transcribe(mp3_file):
|
|
| 126 |
with gr.Blocks() as demo:
|
| 127 |
gr.Markdown("Start typing below and then click **Run** to see the progress and final output.")
|
| 128 |
with gr.Column():
|
| 129 |
-
audio_in = gr.Audio(type="filepath")
|
|
|
|
| 130 |
srt_file = gr.File()
|
| 131 |
btn = gr.Button("Create")
|
| 132 |
video_file_output = gr.Video(label="Result Video")
|
| 133 |
btn.click(
|
| 134 |
fn=transcribe,
|
| 135 |
-
inputs=
|
| 136 |
outputs=srt_file,
|
| 137 |
)
|
| 138 |
|
|
|
|
| 115 |
f.close()
|
| 116 |
return subtitle_file
|
| 117 |
|
| 118 |
+
def transcribe(url):
|
| 119 |
+
|
| 120 |
+
video = download_video(url)
|
| 121 |
+
mp3_file, duration = extract_audio(video)
|
| 122 |
print("transcribe")
|
| 123 |
wordlevel_info=word_level_transcribe(mp3_file)
|
| 124 |
subtitles = create_subtitles(wordlevel_info)
|
|
|
|
| 128 |
with gr.Blocks() as demo:
|
| 129 |
gr.Markdown("Start typing below and then click **Run** to see the progress and final output.")
|
| 130 |
with gr.Column():
|
| 131 |
+
#audio_in = gr.Audio(type="filepath")
|
| 132 |
+
url = gr.Text()
|
| 133 |
srt_file = gr.File()
|
| 134 |
btn = gr.Button("Create")
|
| 135 |
video_file_output = gr.Video(label="Result Video")
|
| 136 |
btn.click(
|
| 137 |
fn=transcribe,
|
| 138 |
+
inputs=url,
|
| 139 |
outputs=srt_file,
|
| 140 |
)
|
| 141 |
|