fehmikaya commited on
Commit
d9e74a8
·
verified ·
1 Parent(s): 8b15c9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -9,7 +9,8 @@ def streamer(text):
9
  yield i
10
  time.sleep(0.005)
11
 
12
- st.session_state.console_out=""
 
13
 
14
  # Streamlit app initialization
15
  st.title("RAG AGENT")
@@ -37,9 +38,7 @@ with st.sidebar:
37
  print("Link uploaded:"+video_url)
38
 
39
  st.success("Done")
40
- st.markdown("Console:")
41
- with st.container(height=200):
42
- st.text_area("Console",value=st.session_state.console_out, height=2000)
43
 
44
  user_prompt = st.chat_input("Ask me anything about the content of the PDF or Web Link:")
45
 
@@ -51,7 +50,7 @@ if user_prompt and (uploaded_file or video_url):
51
  # Trigger assistant's response retrieval and update UI
52
  with st.spinner("Thinking..."):
53
  response = "I have an answer coming soon..."
54
- st.session_state.console_out=st.session_state.console_out+response+"\n"
55
  with st.chat_message("user", avatar="robot.png"):
56
  st.write_stream(streamer(response))
57
  st.session_state.messages.append({'role': 'assistant', "content": response})
 
9
  yield i
10
  time.sleep(0.005)
11
 
12
+ if "console_out" not in st.session_state:
13
+ st.session_state["console_out"] = "Default text"
14
 
15
  # Streamlit app initialization
16
  st.title("RAG AGENT")
 
38
  print("Link uploaded:"+video_url)
39
 
40
  st.success("Done")
41
+ st.text_area("Console",value=st.session_state["console_out"], height=200)
 
 
42
 
43
  user_prompt = st.chat_input("Ask me anything about the content of the PDF or Web Link:")
44
 
 
50
  # Trigger assistant's response retrieval and update UI
51
  with st.spinner("Thinking..."):
52
  response = "I have an answer coming soon..."
53
+ st.session_state["console_out"]=st.session_state["console_out"]+response+"\n"
54
  with st.chat_message("user", avatar="robot.png"):
55
  st.write_stream(streamer(response))
56
  st.session_state.messages.append({'role': 'assistant', "content": response})