Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,9 +29,9 @@ def chat_with_model(prompt, document_section):
|
|
29 |
if len(document_section)>0:
|
30 |
conversation.append({'role': 'assistant', 'content': document_section})
|
31 |
response = openai.ChatCompletion.create(model=model, messages=conversation)
|
32 |
-
return response
|
33 |
-
|
34 |
-
|
35 |
def transcribe_audio(openai_key, file_path, model):
|
36 |
OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
|
37 |
headers = {
|
@@ -141,8 +141,6 @@ menu = ["htm", "txt", "xlsx", "csv", "md", "py"] #619
|
|
141 |
choice = st.sidebar.selectbox("Output File Type:", menu)
|
142 |
model_choice = st.sidebar.radio("Select Model:", ('gpt-3.5-turbo', 'gpt-3.5-turbo-0301'))
|
143 |
|
144 |
-
|
145 |
-
|
146 |
# Audio, transcribe, GPT:
|
147 |
filename = save_and_play_audio(audio_recorder)
|
148 |
if filename is not None:
|
|
|
29 |
if len(document_section)>0:
|
30 |
conversation.append({'role': 'assistant', 'content': document_section})
|
31 |
response = openai.ChatCompletion.create(model=model, messages=conversation)
|
32 |
+
#return response
|
33 |
+
return response['choices'][0]['message']['content']
|
34 |
+
|
35 |
def transcribe_audio(openai_key, file_path, model):
|
36 |
OPENAI_API_URL = "https://api.openai.com/v1/audio/transcriptions"
|
37 |
headers = {
|
|
|
141 |
choice = st.sidebar.selectbox("Output File Type:", menu)
|
142 |
model_choice = st.sidebar.radio("Select Model:", ('gpt-3.5-turbo', 'gpt-3.5-turbo-0301'))
|
143 |
|
|
|
|
|
144 |
# Audio, transcribe, GPT:
|
145 |
filename = save_and_play_audio(audio_recorder)
|
146 |
if filename is not None:
|