Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,18 @@ from groq import Groq
|
|
9 |
os.environ['GROQ_API_KEY'] = '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'
|
10 |
groq_client = Groq(api_key=os.environ.get('GROQ_API_KEY'))
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def process_audio(audio_file):
|
|
|
|
|
|
|
16 |
try:
|
17 |
# Transcribe audio using Whisper
|
18 |
result = whisper_model.transcribe(audio_file)
|
|
|
9 |
os.environ['GROQ_API_KEY'] = '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'
|
10 |
groq_client = Groq(api_key=os.environ.get('GROQ_API_KEY'))
|
11 |
|
12 |
+
# Attempt to load Whisper model
|
13 |
+
try:
|
14 |
+
whisper_model = whisper.load_model("base")
|
15 |
+
except AttributeError:
|
16 |
+
# Handle alternative model loading or print error
|
17 |
+
print("Error: The 'whisper' library does not support 'load_model'.")
|
18 |
+
whisper_model = None
|
19 |
|
20 |
def process_audio(audio_file):
|
21 |
+
if whisper_model is None:
|
22 |
+
return "Whisper model could not be loaded.", None
|
23 |
+
|
24 |
try:
|
25 |
# Transcribe audio using Whisper
|
26 |
result = whisper_model.transcribe(audio_file)
|