JBHF commited on
Commit
90e25d7
1 Parent(s): bf2e735

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -158,8 +158,9 @@ if "vector" not in st.session_state:
158
  # st.session_state.docs = docs
159
 
160
 
161
-
162
- with st.status("Downloading data...", expanded=True) as status:
 
163
  # st.write("Searching for data...")
164
  # time.sleep(2)
165
  # st.write("Found URL.")
@@ -336,10 +337,18 @@ if prompt := st.chat_input():
336
  start = time.process_time()
337
  response = retrieval_chain.invoke({"input": prompt})
338
  # print(f"Response time: {time.process_time() - start}")
339
- st.write(f"Response time: {time.process_time() - start} seconds")
340
 
341
  # st.write(response["answer"])
342
 
 
 
 
 
 
 
 
 
343
 
344
  #client = OpenAI(api_key=openai_api_key)
345
  st.session_state.messages.append({"role": "user", "content": prompt})
@@ -348,7 +357,9 @@ if prompt := st.chat_input():
348
  # msg = response.choices[0].message.content
349
  msg = response["answer"]
350
  st.session_state.messages.append({"role": "assistant", "content": msg})
351
- st.chat_message("assistant").write(msg)
 
 
352
 
353
  # With a streamlit expander
354
  with st.expander("Document Similarity Search"):
 
158
  # st.session_state.docs = docs
159
 
160
 
161
+ # https://docs.streamlit.io/library/api-reference/status/st.status
162
+ # st.status(label, *, expanded=False, state="running")
163
+ with st.status("Laden van de PDF documenten / Splitting de teksten / Genereer de Vector Store ...", expanded=True) as status:
164
  # st.write("Searching for data...")
165
  # time.sleep(2)
166
  # st.write("Found URL.")
 
337
  start = time.process_time()
338
  response = retrieval_chain.invoke({"input": prompt})
339
  # print(f"Response time: {time.process_time() - start}")
340
+ st.write(f"Response time van de LLM: {time.process_time() - start} seconds")
341
 
342
  # st.write(response["answer"])
343
 
344
+ # https://docs.streamlit.io/library/api-reference/chat/st.chat_message
345
+ # st.chat_message(name, *, avatar=None)
346
+ # The avatar shown next to the message. Can be one of:
347
+ # - A single emoji, e.g. "🧑‍💻", "🤖", "🦖". Shortcodes are not supported.
348
+ # - An image using one of the formats allowed for st.image: path of a local image file;
349
+ # URL to fetch the image from; an SVG image; array of shape (w,h) or (w,h,1) for a monochrome image,
350
+ # (w,h,3) for a color image, or (w,h,4) for an RGBA image.
351
+ # If None (default), uses default icons if name is "user", "assistant", "ai", "human" or the first letter of the name value.
352
 
353
  #client = OpenAI(api_key=openai_api_key)
354
  st.session_state.messages.append({"role": "user", "content": prompt})
 
357
  # msg = response.choices[0].message.content
358
  msg = response["answer"]
359
  st.session_state.messages.append({"role": "assistant", "content": msg})
360
+ # st.chat_message("assistant").write(msg)
361
+ # MET ALS AVATAR EEN IMAGE VAN VICTOR:
362
+ st.chat_message("assistant", avatar=None).write(msg)
363
 
364
  # With a streamlit expander
365
  with st.expander("Document Similarity Search"):