Maxenceleguery commited on
Commit
6c60b63
·
1 Parent(s): b9e8b68

:shirt: Formatting

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -98,7 +98,9 @@ def load_file_from_response(response):
98
 
99
  elif "audio/" in content_type:
100
  # Transcribe audio using OpenAI Whisper
101
- transcript = openai.Audio.transcribe("whisper-1", io.BytesIO(content_bytes))
 
 
102
  return {"type": "text", "data": transcript.get("text", "")}
103
 
104
  elif "application/octet-stream" in content_type:
@@ -119,7 +121,9 @@ def load_file_from_response(response):
119
  # Try audio
120
  try:
121
  # Transcribe audio from raw bytes
122
- transcript = openai.Audio.transcribe(model="whisper-1", file=io.BytesIO(content_bytes))
 
 
123
  return {"type": "text", "data": transcript.get("text", "")}
124
  except Exception as e:
125
  print(f"Error transcribing audio")
 
98
 
99
  elif "audio/" in content_type:
100
  # Transcribe audio using OpenAI Whisper
101
+ transcript = openai.Audio.transcribe(
102
+ model="whisper-1", file=io.BytesIO(content_bytes)
103
+ )
104
  return {"type": "text", "data": transcript.get("text", "")}
105
 
106
  elif "application/octet-stream" in content_type:
 
121
  # Try audio
122
  try:
123
  # Transcribe audio from raw bytes
124
+ transcript = openai.Audio.transcribe(
125
+ model="whisper-1", file=io.BytesIO(content_bytes)
126
+ )
127
  return {"type": "text", "data": transcript.get("text", "")}
128
  except Exception as e:
129
  print(f"Error transcribing audio")