Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,10 @@ def transcribe(inputs_path, task, use_demucs, dataset_name, oauth_token: gr.OAut
|
|
| 42 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 43 |
if dataset_name is None:
|
| 44 |
raise gr.Error("No dataset name submitted! Please submit a dataset name. Should be in the format : <user>/<dataset_name> or <org>/<dataset_name>. Also accepts <dataset_name>, which will default to the namespace of the logged-in user.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
total_step = 4
|
| 47 |
current_step = 0
|
|
@@ -137,13 +141,18 @@ def yt_transcribe(yt_url, task, use_demucs, dataset_name, oauth_token: gr.OAuthT
|
|
| 137 |
raise gr.Error("No youtube link submitted! Please put a working link.")
|
| 138 |
if dataset_name is None:
|
| 139 |
raise gr.Error("No dataset name submitted! Please submit a dataset name. Should be in the format : <user>/<dataset_name> or <org>/<dataset_name>. Also accepts <dataset_name>, which will default to the namespace of the logged-in user.")
|
| 140 |
-
|
| 141 |
total_step = 5
|
| 142 |
current_step = 0
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
current_step += 1
|
| 145 |
progress((current_step, total_step), desc="Load video.")
|
| 146 |
-
html_embed_str = _return_yt_html_embed(yt_url)
|
| 147 |
|
| 148 |
with tempfile.TemporaryDirectory() as tmpdirname:
|
| 149 |
filepath = os.path.join(tmpdirname, "video.mp4")
|
|
|
|
| 42 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 43 |
if dataset_name is None:
|
| 44 |
raise gr.Error("No dataset name submitted! Please submit a dataset name. Should be in the format : <user>/<dataset_name> or <org>/<dataset_name>. Also accepts <dataset_name>, which will default to the namespace of the logged-in user.")
|
| 45 |
+
|
| 46 |
+
if oauth_token is None:
|
| 47 |
+
gr.Warning("Make sure to click and login before using this demo.")
|
| 48 |
+
return [["transcripts will appear here"]], ""
|
| 49 |
|
| 50 |
total_step = 4
|
| 51 |
current_step = 0
|
|
|
|
| 141 |
raise gr.Error("No youtube link submitted! Please put a working link.")
|
| 142 |
if dataset_name is None:
|
| 143 |
raise gr.Error("No dataset name submitted! Please submit a dataset name. Should be in the format : <user>/<dataset_name> or <org>/<dataset_name>. Also accepts <dataset_name>, which will default to the namespace of the logged-in user.")
|
| 144 |
+
|
| 145 |
total_step = 5
|
| 146 |
current_step = 0
|
| 147 |
|
| 148 |
+
html_embed_str = _return_yt_html_embed(yt_url)
|
| 149 |
+
|
| 150 |
+
if oauth_token is None:
|
| 151 |
+
gr.Warning("Make sure to click and login before using this demo.")
|
| 152 |
+
return html_embed_str, [["transcripts will appear here"]], ""
|
| 153 |
+
|
| 154 |
current_step += 1
|
| 155 |
progress((current_step, total_step), desc="Load video.")
|
|
|
|
| 156 |
|
| 157 |
with tempfile.TemporaryDirectory() as tmpdirname:
|
| 158 |
filepath = os.path.join(tmpdirname, "video.mp4")
|