awacke1 commited on
Commit
4536ad8
·
1 Parent(s): acb9ff7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -116,6 +116,16 @@ def read_file_content(file,max_length):
116
  md = mistune.create_markdown()
117
  content = md(file.read().decode())
118
  return content
 
 
 
 
 
 
 
 
 
 
119
  elif file.type == "text/plain":
120
  return file.getvalue().decode()
121
  else:
@@ -201,7 +211,7 @@ def main():
201
  #max_length = 12000 - optimal for gpt35 turbo. 2x=24000 for gpt4. 8x=96000 for gpt4-32k.
202
  max_length = st.slider("File section length for large files", min_value=1000, max_value=128000, value=12000, step=1000)
203
  with colupload:
204
- uploaded_file = st.file_uploader("Add a file for context:", type=["xml", "json", "xlsx","csv","html", "htm", "md", "txt"])
205
 
206
  document_sections = deque()
207
  document_responses = {}
 
116
  md = mistune.create_markdown()
117
  content = md(file.read().decode())
118
  return content
119
+ elif file.type == "audio/wav":
120
+ #0628
121
+ if file is not None:
122
+ transcription = transcribe_audio(openai.api_key, file, "whisper-1")
123
+ st.write(transcription)
124
+ gptOutput = chat_with_model(transcription, '', model_choice) # *************************************
125
+ filename = generate_filename(transcription, choice)
126
+ create_file(filename, transcription, gptOutput)
127
+ st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
128
+ return transcription
129
  elif file.type == "text/plain":
130
  return file.getvalue().decode()
131
  else:
 
211
  #max_length = 12000 - optimal for gpt35 turbo. 2x=24000 for gpt4. 8x=96000 for gpt4-32k.
212
  max_length = st.slider("File section length for large files", min_value=1000, max_value=128000, value=12000, step=1000)
213
  with colupload:
214
+ uploaded_file = st.file_uploader("Add a file for context:", type=["xml", "json", "xlsx","csv","html", "htm", "md", "txt", "wav"])
215
 
216
  document_sections = deque()
217
  document_responses = {}