Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
-
# First, ensure the necessary packages are installed:
|
2 |
-
# pip install -U assemblyai gradio
|
3 |
-
|
4 |
import gradio as gr
|
5 |
import assemblyai as aai
|
|
|
6 |
|
7 |
# Replace with your AssemblyAI API key
|
8 |
aai.settings.api_key = "62acec891bb04c339ec059b738bedac6"
|
@@ -11,6 +9,13 @@ aai.settings.api_key = "62acec891bb04c339ec059b738bedac6"
|
|
11 |
def transcribe_audio(audio_path):
|
12 |
print(f"Received audio file at: {audio_path}")
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
try:
|
15 |
# Transcribe the audio file using AssemblyAI
|
16 |
transcriber = aai.Transcriber()
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import assemblyai as aai
|
3 |
+
import os
|
4 |
|
5 |
# Replace with your AssemblyAI API key
|
6 |
aai.settings.api_key = "62acec891bb04c339ec059b738bedac6"
|
|
|
9 |
def transcribe_audio(audio_path):
|
10 |
print(f"Received audio file at: {audio_path}")
|
11 |
|
12 |
+
# Check if the file exists and is not empty
|
13 |
+
if not os.path.exists(audio_path):
|
14 |
+
return "Error: Audio file does not exist."
|
15 |
+
|
16 |
+
if os.path.getsize(audio_path) == 0:
|
17 |
+
return "Error: Audio file is empty."
|
18 |
+
|
19 |
try:
|
20 |
# Transcribe the audio file using AssemblyAI
|
21 |
transcriber = aai.Transcriber()
|