Spaces:
Runtime error
Runtime error
Commit
·
65e5c0b
1
Parent(s):
0500142
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,7 +114,7 @@ def VideoTranscribe(video):
|
|
| 114 |
def YoutubeTranscribe(URL, retries = 5):
|
| 115 |
if retries:
|
| 116 |
if "youtu" not in URL.lower():
|
| 117 |
-
raise
|
| 118 |
else:
|
| 119 |
try:
|
| 120 |
os.remove("temp_audio.wav")
|
|
@@ -141,13 +141,13 @@ def YoutubeTranscribe(URL, retries = 5):
|
|
| 141 |
pass
|
| 142 |
return Transcribe()
|
| 143 |
else:
|
| 144 |
-
raise
|
| 145 |
|
| 146 |
with gr.Blocks() as i:
|
| 147 |
video = gr.Video()
|
| 148 |
text = gr.Textbox("Input")
|
| 149 |
if not video and not text:
|
| 150 |
-
raise
|
| 151 |
output = gr.Textbox("Output")
|
| 152 |
btn = gr.Button("Run")
|
| 153 |
btn.click(fn=YoutubeTranscribe, inputs=text, outputs=output)
|
|
|
|
| 114 |
def YoutubeTranscribe(URL, retries = 5):
|
| 115 |
if retries:
|
| 116 |
if "youtu" not in URL.lower():
|
| 117 |
+
raise gr.Error(f"{URL} is not a valid youtube URL.")
|
| 118 |
else:
|
| 119 |
try:
|
| 120 |
os.remove("temp_audio.wav")
|
|
|
|
| 141 |
pass
|
| 142 |
return Transcribe()
|
| 143 |
else:
|
| 144 |
+
raise gr.Error(f"Unable to get video from {URL}")
|
| 145 |
|
| 146 |
with gr.Blocks() as i:
|
| 147 |
video = gr.Video()
|
| 148 |
text = gr.Textbox("Input")
|
| 149 |
if not video and not text:
|
| 150 |
+
raise gr.Error("Either input url or video (not both)")
|
| 151 |
output = gr.Textbox("Output")
|
| 152 |
btn = gr.Button("Run")
|
| 153 |
btn.click(fn=YoutubeTranscribe, inputs=text, outputs=output)
|