You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 4, 2026. It is now read-only.
async def speech_to_text(audio_file):
# Unpack the tuple containing filename, audio data, and mime type
filename, audio_data, _ = audio_file
# Save audio data to a temporary file
temp_path = "temp_audio.wav"
with open(temp_path, "wb") as f:
f.write(audio_data)
# Prepare the form data
files = {
'file': ('audio.wav', open(temp_path, 'rb'), 'audio/wav')
}
data = {
'model': 'whisper-1',
'language': 'it',
'response_format': 'json'
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
'http://127.0.0.1:8000/v1/audio/transcriptions',
files=files,
data=data
)
response.raise_for_status()
result = response.json()
# Clean up the temporary file
os.remove(temp_path)
return result['text']
except Exception as e:
print(f"Error during transcription: {e}")
raise
always getting the same methos not allowed error. it works with the code snippet in readme.md so i am wondering if is there a way to make it working with the chainlit code
Client error '405 Method Not Allowed' for url 'http://127.0.0.1:8000/v1/audio/transcriptionsi am trying integrating chainlit https://github.com/Chainlit/cookbook/blob/main/openai-whisper/app.py example using the openedai-whisper endpoint but i am getting the above error. I have tried both the openai lib as well httpx to format the post in a different way
always getting the same methos not allowed error. it works with the code snippet in readme.md so i am wondering if is there a way to make it working with the chainlit code