statisticalplumber commited on
Commit
eb3b875
·
1 Parent(s): dd513e5

changes of session message

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,7 +15,7 @@ def get_audio(url):
15
  video = yt.streams.filter(only_audio=True).first()
16
  out_file=video.download(output_path=".")
17
  base, ext = os.path.splitext(out_file)
18
- new_file = base+'.mp3'
19
  os.rename(out_file, new_file)
20
  a = new_file
21
  return a
@@ -54,11 +54,11 @@ if prompt := st.chat_input():
54
  if not key:
55
  st.markdown('Provide key to chat')
56
  st.stop()
57
- st.session_state.messages.append({'role': 'user', 'content': prompt})
58
  st.chat_message('user').write(prompt)
59
  llm = ChatOpenAI(model_name = 'gpt-3.5-turbo', openai_api_key = key)
60
  msg = llm.predict(template.format(prompt = prompt))
61
- st.session_state.messages.append({'role': 'assistant', 'content': msg})
62
  st.chat_message('assistant').write(msg)
63
 
64
 
 
15
  video = yt.streams.filter(only_audio=True).first()
16
  out_file=video.download(output_path=".")
17
  base, ext = os.path.splitext(out_file)
18
+ new_file = 'input_audio'+'.mp3'
19
  os.rename(out_file, new_file)
20
  a = new_file
21
  return a
 
54
  if not key:
55
  st.markdown('Provide key to chat')
56
  st.stop()
57
+ # st.session_state.messages.append({'role': 'user', 'content': prompt})
58
  st.chat_message('user').write(prompt)
59
  llm = ChatOpenAI(model_name = 'gpt-3.5-turbo', openai_api_key = key)
60
  msg = llm.predict(template.format(prompt = prompt))
61
+ # st.session_state.messages.append({'role': 'assistant', 'content': msg})
62
  st.chat_message('assistant').write(msg)
63
 
64