Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,7 @@ def fetch_youtube_id(youtube_url: str) -> str:
|
|
21 |
return youtube_url.split("/")[-1]
|
22 |
else:
|
23 |
raise Exception("Unsupported URL format")
|
24 |
-
|
25 |
-
def fetch_youtube_id(youtube_url: str) -> str:
|
26 |
-
if 'v=' in youtube_url:
|
27 |
-
return youtube_url.split("v=")[1]
|
28 |
-
elif 'shorts' in youtube_url:
|
29 |
-
return youtube_url.split("/")[-1]
|
30 |
-
else:
|
31 |
-
raise Exception("Unsupported URL format")
|
32 |
-
"""
|
33 |
def download_youtube_audio(youtube_url: str, output_dir: Optional[str] = None) -> str:
|
34 |
video_id = fetch_youtube_id(youtube_url)
|
35 |
|
@@ -160,9 +152,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
160 |
run_button.click(run_asr, inputs=[audio_input, youtube_input], outputs=[result])
|
161 |
|
162 |
def update_button_state(audio, youtube_url):
|
163 |
-
print(" audio
|
164 |
# Button is interactive if there's input and progress is 0 or 1 (not in progress)
|
165 |
-
return gr.Button(interactive=bool(audio) or bool(youtube_url))
|
166 |
|
167 |
audio_input.change(
|
168 |
fn=update_button_state,
|
|
|
21 |
return youtube_url.split("/")[-1]
|
22 |
else:
|
23 |
raise Exception("Unsupported URL format")
|
24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
def download_youtube_audio(youtube_url: str, output_dir: Optional[str] = None) -> str:
|
26 |
video_id = fetch_youtube_id(youtube_url)
|
27 |
|
|
|
152 |
run_button.click(run_asr, inputs=[audio_input, youtube_input], outputs=[result])
|
153 |
|
154 |
def update_button_state(audio, youtube_url):
|
155 |
+
print(" audio: ",audio, " youtube_url: ", youtube_url)
|
156 |
# Button is interactive if there's input and progress is 0 or 1 (not in progress)
|
157 |
+
return gr.Button(interactive=bool(audio) or bool(youtube_url !=))
|
158 |
|
159 |
audio_input.change(
|
160 |
fn=update_button_state,
|