awacke1 commited on
Commit
9d4e370
·
1 Parent(s): 443c49d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -67,12 +67,15 @@ def save_and_play_audio(audio_recorder):
67
  return filename
68
  return None
69
 
 
70
  filename = save_and_play_audio(audio_recorder)
71
  if filename is not None:
72
- if st.button("Transcribe"):
73
- transcription = transcribe_audio(openai.api_key, filename, "whisper-1")
74
- st.write(transcription)
75
- chat_with_model(transcription, '') # push transcript through as prompt
 
 
76
 
77
  def create_file(filename, prompt, response):
78
  if filename.endswith(".txt"):
 
67
  return filename
68
  return None
69
 
70
+ # Updated to call direct from transcription to chat inference.
71
  filename = save_and_play_audio(audio_recorder)
72
  if filename is not None:
73
+ #if st.button("Transcribe"):
74
+ transcription = transcribe_audio(openai.api_key, filename, "whisper-1")
75
+ st.markdown('### Transcription:')
76
+ st.write(transcription)
77
+ #chat_with_model(transcription, '') # push transcript through as prompt
78
+ response2 = chat_with_model(transcription.json().get('text'), '')
79
 
80
  def create_file(filename, prompt, response):
81
  if filename.endswith(".txt"):