Spaces:
Sleeping
Sleeping
Commit
·
176e214
1
Parent(s):
c8672f7
feat: wait for audio to be uploaded
Browse files
app.py
CHANGED
@@ -15,6 +15,11 @@ def read_file_as_base64(file_path: str) -> str:
|
|
15 |
def transcribe_audio(audio: str) -> str:
|
16 |
print(f"{audio=}")
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
b64 = read_file_as_base64(audio)
|
19 |
url = f"https://api-inference.huggingface.co/models/{model_id}"
|
20 |
headers = {
|
|
|
15 |
def transcribe_audio(audio: str) -> str:
|
16 |
print(f"{audio=}")
|
17 |
|
18 |
+
if audio is None:
|
19 |
+
raise gr.Error(
|
20 |
+
"Please wait a moment for the audio to be uploaded, then click the button again."
|
21 |
+
)
|
22 |
+
|
23 |
b64 = read_file_as_base64(audio)
|
24 |
url = f"https://api-inference.huggingface.co/models/{model_id}"
|
25 |
headers = {
|