Update app.py
Browse files
app.py
CHANGED
@@ -107,27 +107,6 @@ def run_asr(audio_file, youtube_url):
|
|
107 |
if temp_file and os.path.exists(temp_file):
|
108 |
os.remove(temp_file)
|
109 |
|
110 |
-
def embed_youtube(youtube_url):
|
111 |
-
global last_modified
|
112 |
-
if youtube_url:
|
113 |
-
try:
|
114 |
-
video_id = fetch_youtube_id(youtube_url)
|
115 |
-
embed_html = f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'
|
116 |
-
last_modified = 2;
|
117 |
-
print ("last_modified 2:",last_modified)
|
118 |
-
return gr.update(value=embed_html, visible=True), "", None
|
119 |
-
except Exception as e:
|
120 |
-
return gr.update(value="", visible=False), f"Invalid YouTube URL: {str(e)}", None
|
121 |
-
return gr.update(value="", visible=False), "", None
|
122 |
-
|
123 |
-
def clear_on_audio_input(audio):
|
124 |
-
global last_modified
|
125 |
-
print ("audio:", audio)
|
126 |
-
if audio is not None:
|
127 |
-
last_modified =1
|
128 |
-
print ("last_modified 1:",last_modified)
|
129 |
-
return "", gr.update(), gr.update(), gr.update(interactive=True)
|
130 |
-
return gr.update(), gr.update(), gr.update(), gr.update(interactive=False)
|
131 |
|
132 |
# Create the Gradio interface with improved aesthetics
|
133 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
107 |
if temp_file and os.path.exists(temp_file):
|
108 |
os.remove(temp_file)
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
# Create the Gradio interface with improved aesthetics
|
112 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|