Spaces:
Sleeping
Sleeping
Commit
·
2ad9a80
1
Parent(s):
fcd8049
Fix audio transcription to use correct Groq API format
Browse files- Changed to pass file contents instead of file object
- Using (filename, file_contents) tuple format per Groq documentation
- Added temperature=0.0 parameter for consistent results
app.py
CHANGED
|
@@ -100,14 +100,15 @@ class ToolRegistry:
|
|
| 100 |
if not any(filename.lower().endswith(ext) for ext in ['.wav', '.mp3', '.webm', '.m4a', '.ogg']):
|
| 101 |
filename = 'audio.wav'
|
| 102 |
|
| 103 |
-
#
|
| 104 |
-
#
|
| 105 |
-
|
| 106 |
|
| 107 |
transcription = groq_client.audio.transcriptions.create(
|
| 108 |
-
file=
|
| 109 |
model="whisper-large-v3-turbo",
|
| 110 |
-
response_format="text"
|
|
|
|
| 111 |
)
|
| 112 |
return str(transcription)
|
| 113 |
except Exception as e:
|
|
|
|
| 100 |
if not any(filename.lower().endswith(ext) for ext in ['.wav', '.mp3', '.webm', '.m4a', '.ogg']):
|
| 101 |
filename = 'audio.wav'
|
| 102 |
|
| 103 |
+
# Read the file contents and create tuple as per Groq API documentation
|
| 104 |
+
# Format: (filename, file_contents)
|
| 105 |
+
file_contents = audio_file.read()
|
| 106 |
|
| 107 |
transcription = groq_client.audio.transcriptions.create(
|
| 108 |
+
file=(filename, file_contents),
|
| 109 |
model="whisper-large-v3-turbo",
|
| 110 |
+
response_format="text",
|
| 111 |
+
temperature=0.0
|
| 112 |
)
|
| 113 |
return str(transcription)
|
| 114 |
except Exception as e:
|