Sandaruth commited on
Commit
5f8dde6
1 Parent(s): 3630a6a

update app

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -4,8 +4,7 @@ import time
4
 
5
  from htmlTemplates import css, bot_template, user_template, source_template
6
 
7
- st.set_page_config(page_title="Chat with papers",
8
- page_icon=":books:")
9
  st.write(css, unsafe_allow_html=True)
10
 
11
  def main():
@@ -42,20 +41,22 @@ def main():
42
  if st.button("Send"):
43
  if user_input:
44
 
45
- # Add bot response here (you can replace this with your bot logic)
46
- response, metadata, source_documents = generate_bot_response(user_input)
47
- st.write(user_template.replace(
48
- "{{MSG}}", user_input), unsafe_allow_html=True)
49
- st.write(bot_template.replace(
50
- "{{MSG}}", response ), unsafe_allow_html=True)
51
 
52
- # Source documents
53
- print("metadata", metadata)
54
- st.sidebar.title("Source Documents")
55
- for i, doc in enumerate(source_documents, 1):
56
- tit=metadata[i-1]["source"].split("\\")[-1]
57
- with st.sidebar.expander(f"{tit}"):
58
- st.write(doc) # Assuming the Document object can be directly written to display its content
 
 
 
 
 
 
 
59
 
60
  def generate_bot_response(user_input):
61
  # Simple bot logic (replace with your actual bot logic)
 
4
 
5
  from htmlTemplates import css, bot_template, user_template, source_template
6
 
7
+ st.set_page_config(page_title="Chat with ATrad",page_icon=":currency_exchange:")
 
8
  st.write(css, unsafe_allow_html=True)
9
 
10
  def main():
 
41
  if st.button("Send"):
42
  if user_input:
43
 
44
+ with st.spinner('Waiting for response...'):
 
 
 
 
 
45
 
46
+ # Add bot response here (you can replace this with your bot logic)
47
+ response, metadata, source_documents = generate_bot_response(user_input)
48
+ st.write(user_template.replace(
49
+ "{{MSG}}", user_input), unsafe_allow_html=True)
50
+ st.write(bot_template.replace(
51
+ "{{MSG}}", response ), unsafe_allow_html=True)
52
+
53
+ # Source documents
54
+ print("metadata", metadata)
55
+ st.sidebar.title("Source Documents")
56
+ for i, doc in enumerate(source_documents, 1):
57
+ tit=metadata[i-1]["source"].split("\\")[-1]
58
+ with st.sidebar.expander(f"{tit}"):
59
+ st.write(doc) # Assuming the Document object can be directly written to display its content
60
 
61
  def generate_bot_response(user_input):
62
  # Simple bot logic (replace with your actual bot logic)