-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Whisper stt model #4352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Whisper stt model #4352
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,11 +52,11 @@ def speech_to_text(self, audio_file): | |
| api_key=self.api_key, | ||
| base_url=base_url | ||
| ) | ||
|
|
||
| buf = audio_file.read() | ||
| filter_params = {k: v for k, v in self.params.items() if k not in {'model_id', 'use_local', 'streaming'}} | ||
| transcription_params = { | ||
| 'model': self.model, | ||
| 'file': audio_file, | ||
| 'file': buf, | ||
| 'language': 'zh', | ||
| } | ||
| result = client.audio.transcriptions.create( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code has a minor issue with how the Here’s a corrected version of your function: def speech_to_text(self, audio_file):
api_key = self.api_key
base_url = "your_base_url" # Replace with the actual URL
client = google.cloud.speech_v2.SpeechClient(credentials=self.credentials, region_name='us-east1')
filter_params = {k: v for k, v in self.params.items() if k not in {'model_id', 'use_local', 'streaming'}}
transcription_params = {
'model': self.model,
'config': {
'enable_word_confidence': True,
'encoding': media_audio.RecognitionConfig.AudioEncoding.LINEAR16,
'sample_rate_hertz': 44_100,
'language_code': 'zh-CN'
},
'audio': {
'content': (buf := audio_file.read())
}
}
response = client.long_running_recognize(transcription_params)
return responseKey Changes:
This should resolve the potential issues related to memory usage and ensure proper formatting according to the latest requirements from Google Cloud Speech-to-Text. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
TooltipLabelfield should be replaced with'TooltipText'. Here's the corrected version of your code:Explanation:
TooltipLabelin thetooltip_args=parameter would result in an error because there is no such argument supported byforms.TextInputField.TooltipLabelwithTooltipText, which seems to be the intended usage for providing tooltips in Django forms.TooltipText.This change ensures that the tooltip will display correctly when rendering the form in the user interface.