awacke1 commited on
Commit
8bd327b
·
1 Parent(s): 2593d8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -59,10 +59,12 @@ def transcribe_audio(openai_key, file_path, model):
59
  response = requests.post(OPENAI_API_URL, headers=headers, files=data, data={'model': model})
60
  if response.status_code == 200:
61
  st.write('Reasoning with your transcription..')
62
- st.write(response.json())
63
- response2 = chat_with_model(response.json().get('text'), '') # send transcript to ChatGPT
64
- create_file(filename, response, response2)
65
- return response2
 
 
66
  else:
67
  st.write(response.json())
68
  st.error("Error in API call.")
@@ -71,7 +73,7 @@ def transcribe_audio(openai_key, file_path, model):
71
  def save_and_play_audio(audio_recorder):
72
  audio_bytes = audio_recorder()
73
  if audio_bytes:
74
- filename = generate_filename("Recording", "wav")
75
  with open(filename, 'wb') as f:
76
  f.write(audio_bytes)
77
  st.audio(audio_bytes, format="audio/wav")
 
59
  response = requests.post(OPENAI_API_URL, headers=headers, files=data, data={'model': model})
60
  if response.status_code == 200:
61
  st.write('Reasoning with your transcription..')
62
+ transcript=response.json().get('text')
63
+ st.write(transcript)
64
+ gptResponse = chat_with_model(, '') # send transcript to ChatGPT
65
+ filename = generate_filename(transcript, choice) # auto name file with date and prompt per output file type
66
+ create_file(filename, transcript, gptResponse) # write output file
67
+ return gptResponse
68
  else:
69
  st.write(response.json())
70
  st.error("Error in API call.")
 
73
  def save_and_play_audio(audio_recorder):
74
  audio_bytes = audio_recorder()
75
  if audio_bytes:
76
+ filename = generate_filename("RecordingForTranscriptionInput", "wav")
77
  with open(filename, 'wb') as f:
78
  f.write(audio_bytes)
79
  st.audio(audio_bytes, format="audio/wav")