eaglelandsonce commited on
Commit
b57b1fa
·
1 Parent(s): 7f61f1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -19,7 +19,7 @@ import streamlit as st
19
 
20
  st.set_page_config(page_title="Chat Toolkit",layout="wide")
21
 
22
- with st.sidebar.expander("Model Options", expanded=True):
23
  menu = ["htm", "txt", "xlsx", "csv", "md", "py"] #619
24
  choice = st.selectbox("Output File Type:", menu)
25
  model_choice = st.radio("Select Model:", ('gpt-3.5-turbo', 'gpt-3.5-turbo-0301', 'gpt-4'))
@@ -148,16 +148,7 @@ def main():
148
  api_key = st.sidebar.text_input("Enter OpenAI API Key:", type='password')
149
  if api_key:
150
  openai.api_key = api_key
151
- from audio_recorder_streamlit import audio_recorder
152
- # Audio, transcribe, GPT:
153
- filename = save_and_play_audio(audio_recorder)
154
- if filename is not None:
155
- transcription = transcribe_audio(openai.api_key, filename, "whisper-1")
156
- st.write(transcription)
157
- gptOutput = chat_with_model(transcription, '') # push transcript through as prompt
158
- filename = generate_filename(transcription, choice)
159
- create_file(filename, transcription, gptOutput)
160
- st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
161
 
162
  uploaded_file = st.sidebar.file_uploader("Add a file for context:", type=["xml", "json", "xlsx","csv","html", "htm", "md", "txt"])
163
  max_length = st.sidebar.slider("File section length for large files", min_value=1000, max_value=128000, value=12000, step=1000)
@@ -206,6 +197,17 @@ def main():
206
  os.remove(file)
207
  st.experimental_rerun()
208
 
 
 
 
 
 
 
 
 
 
 
 
209
  user_prompt = st.text_area("Enter prompts, instructions & questions:", '', height=100)
210
 
211
  if st.button('💬 Chat'):
 
19
 
20
  st.set_page_config(page_title="Chat Toolkit",layout="wide")
21
 
22
+ with st.sidebar.expander("Model Options", expanded=False):
23
  menu = ["htm", "txt", "xlsx", "csv", "md", "py"] #619
24
  choice = st.selectbox("Output File Type:", menu)
25
  model_choice = st.radio("Select Model:", ('gpt-3.5-turbo', 'gpt-3.5-turbo-0301', 'gpt-4'))
 
148
  api_key = st.sidebar.text_input("Enter OpenAI API Key:", type='password')
149
  if api_key:
150
  openai.api_key = api_key
151
+
 
 
 
 
 
 
 
 
 
152
 
153
  uploaded_file = st.sidebar.file_uploader("Add a file for context:", type=["xml", "json", "xlsx","csv","html", "htm", "md", "txt"])
154
  max_length = st.sidebar.slider("File section length for large files", min_value=1000, max_value=128000, value=12000, step=1000)
 
197
  os.remove(file)
198
  st.experimental_rerun()
199
 
200
+ from audio_recorder_streamlit import audio_recorder
201
+ # Audio, transcribe, GPT:
202
+ filename = save_and_play_audio(audio_recorder)
203
+ if filename is not None:
204
+ transcription = transcribe_audio(openai.api_key, filename, "whisper-1")
205
+ st.write(transcription)
206
+ gptOutput = chat_with_model(transcription, '') # push transcript through as prompt
207
+ filename = generate_filename(transcription, choice)
208
+ create_file(filename, transcription, gptOutput)
209
+ st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
210
+
211
  user_prompt = st.text_area("Enter prompts, instructions & questions:", '', height=100)
212
 
213
  if st.button('💬 Chat'):