Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
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("
|
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")
|