awacke1 commited on
Commit
65686f2
·
1 Parent(s): 1a1e9ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -47,15 +47,15 @@ def generate_filename(prompt, file_type):
47
  safe_prompt = "".join(x for x in replaced_prompt if x.isalnum() or x == "_")[:90]
48
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
49
 
50
- def transcribe_audio(openai_key, file_path, model):
51
- OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
52
  key = os.getenv('OPENAI_KEY')
53
-
54
  headers = {
55
  "Authorization": f"Bearer {key}",
56
  }
57
  with open(file_path, 'rb') as f:
58
  data = {'file': f}
 
 
59
  response = requests.post(OPENAI_API_URL, headers=headers, files=data, data={'model': model})
60
  if response.status_code == 200:
61
  st.write(response.json())
@@ -363,7 +363,7 @@ def get_zip_download_link(zip_file):
363
 
364
 
365
  def main():
366
- openai.api_key = os.getenv('OPENAI_KEY')
367
 
368
  # File type for output, model choice
369
  menu = ["txt", "htm", "xlsx", "csv", "md", "py"]
 
47
  safe_prompt = "".join(x for x in replaced_prompt if x.isalnum() or x == "_")[:90]
48
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
49
 
50
+ def transcribe_audio(file_path, model):
 
51
  key = os.getenv('OPENAI_KEY')
 
52
  headers = {
53
  "Authorization": f"Bearer {key}",
54
  }
55
  with open(file_path, 'rb') as f:
56
  data = {'file': f}
57
+ st.write("Read file {file_path}", file_path)
58
+ OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
59
  response = requests.post(OPENAI_API_URL, headers=headers, files=data, data={'model': model})
60
  if response.status_code == 200:
61
  st.write(response.json())
 
363
 
364
 
365
  def main():
366
+ #openai.api_key = os.getenv('OPENAI_KEY')
367
 
368
  # File type for output, model choice
369
  menu = ["txt", "htm", "xlsx", "csv", "md", "py"]