Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -61,7 +61,13 @@ def transcribe_audio(openai_key, file_path, model):
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
if filename.endswith(".txt"):
|
66 |
with open(filename, 'w') as file:
|
67 |
file.write(f"Prompt:\n{prompt}\nResponse:\n{response}")
|
@@ -72,13 +78,6 @@ def transcribe_audio(openai_key, file_path, model):
|
|
72 |
with open(filename, 'w') as file:
|
73 |
file.write(f"# Prompt:\n{prompt}\n# Response:\n{response}")
|
74 |
|
75 |
-
(filename, response, response2)
|
76 |
-
return response2
|
77 |
-
else:
|
78 |
-
st.write(response.json())
|
79 |
-
st.error("Error in API call.")
|
80 |
-
return None
|
81 |
-
|
82 |
def save_and_play_audio(audio_recorder):
|
83 |
audio_bytes = audio_recorder()
|
84 |
if audio_bytes:
|
|
|
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 |
+
return response2
|
65 |
+
else:
|
66 |
+
st.write(response.json())
|
67 |
+
st.error("Error in API call.")
|
68 |
+
return None
|
69 |
+
|
70 |
+
def create_file(filename, prompt, response):
|
71 |
if filename.endswith(".txt"):
|
72 |
with open(filename, 'w') as file:
|
73 |
file.write(f"Prompt:\n{prompt}\nResponse:\n{response}")
|
|
|
78 |
with open(filename, 'w') as file:
|
79 |
file.write(f"# Prompt:\n{prompt}\n# Response:\n{response}")
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
def save_and_play_audio(audio_recorder):
|
82 |
audio_bytes = audio_recorder()
|
83 |
if audio_bytes:
|