awacke1 commited on
Commit
b43823f
·
1 Parent(s): d231927

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -33,10 +33,9 @@ def generate_filename(prompt, file_type):
33
 
34
  # Audio record and transcribe:
35
  def transcribe_audio_ui(openai_key, file_path):
36
- OPENAI_API_KEY = openai_key
37
  OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
38
  headers = {
39
- "Authorization": f"Bearer {OPENAI_API_KEY}",
40
  "Content-Type": "multipart/form-data",
41
  }
42
  def transcribe_audio(file_path, model):
@@ -46,8 +45,10 @@ def transcribe_audio_ui(openai_key, file_path):
46
  }
47
  response = requests.post(OPENAI_API_URL, headers=headers, files=data)
48
  if response.status_code == 200:
 
49
  return response.json().get('text')
50
  else:
 
51
  st.error("Error in API call.")
52
  return None
53
  if file_path is not None:
 
33
 
34
  # Audio record and transcribe:
35
  def transcribe_audio_ui(openai_key, file_path):
 
36
  OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
37
  headers = {
38
+ "Authorization": f"Bearer {openai_key}",
39
  "Content-Type": "multipart/form-data",
40
  }
41
  def transcribe_audio(file_path, model):
 
45
  }
46
  response = requests.post(OPENAI_API_URL, headers=headers, files=data)
47
  if response.status_code == 200:
48
+ st.write(response.json())
49
  return response.json().get('text')
50
  else:
51
+ st.write(response.json())
52
  st.error("Error in API call.")
53
  return None
54
  if file_path is not None: