-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Whisper models are not working and this appears:
Error: Exception: Error during transcription: Exception: Failed to transcribe: 413 - {"error":"Cannot read properties of undefined (reading 'error')","output":null}
or:
Error: Exception: Error during transcription: Exception: Failed to transcribe: 413 - {"error":"Cannot read properties of undefined (reading 'includes')","output":null}
And this the code if you need it:
dart
import 'dart:convert';
import 'package:http/http.dart' as http;
Future transcribeAudio() async {
const String apiKey = 'YOUR_API_KEY_HERE';
// Endpoint for Whisper Large V3 Turbo
const String apiUrl = 'https://api.bytez.com/models/v2/openai/whisper-large-v3-turbo';
// The audio file that is causing the 413 error
const String audioUrl = 'https://archive.org/download/AliThiabPart2SaedYounesPodcast/Ali_Thiab_Part2_Saed_Younes_Podcast.mp3';
try {
print('Sending request to: $apiUrl');
print('Audio URL: $audioUrl');
final response = await http.post(
Uri.parse(apiUrl),
headers: {
'Content-Type': 'application/json',
'Authorization': apiKey,
},
// We are sending a JSON body with the URL.
.
body: jsonEncode({
"url": audioUrl,
"return_timestamps": true,
}),
);
print('Response Status Code: ${response.statusCode}');
print('Response Body: ${response.body}');
} catch (e) {
print('Error: $e');
}
}
void main() {
transcribeAudio();
}