Daoneeee commited on
Commit
fa456cc
·
1 Parent(s): dfc3add

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -94,7 +94,10 @@ def handle_userinput(user_question):
94
 
95
 
96
  def main():
97
- st.set_page_config(page_title="Chat with multiple Files", page_icon=":books:")
 
 
 
98
 
99
  if "conversation" not in st.session_state:
100
  st.session_state.conversation = None
@@ -103,16 +106,20 @@ def main():
103
 
104
  st.header("Chat with multiple Files :")
105
  user_question = st.text_input("Ask a question about your documents:")
 
 
106
 
107
  with st.sidebar:
 
 
 
 
108
  st.subheader("Your documents")
109
  docs = st.file_uploader(
110
- "Upload your files here and click on 'Process'",
111
- accept_multiple_files=True
112
- )
113
-
114
  if st.button("Process"):
115
  with st.spinner("Processing"):
 
116
  doc_list = []
117
 
118
  for file in docs:
 
94
 
95
 
96
  def main():
97
+ load_dotenv()
98
+ st.set_page_config(page_title="Chat with multiple Files",
99
+ page_icon=":books:")
100
+ st.write(css, unsafe_allow_html=True)
101
 
102
  if "conversation" not in st.session_state:
103
  st.session_state.conversation = None
 
106
 
107
  st.header("Chat with multiple Files :")
108
  user_question = st.text_input("Ask a question about your documents:")
109
+ if user_question:
110
+ handle_userinput(user_question)
111
 
112
  with st.sidebar:
113
+ openai_key = st.text_input("Paste your OpenAI API key (sk-...)")
114
+ if openai_key:
115
+ os.environ["OPENAI_API_KEY"] = openai_key
116
+
117
  st.subheader("Your documents")
118
  docs = st.file_uploader(
119
+ "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
 
 
 
120
  if st.button("Process"):
121
  with st.spinner("Processing"):
122
+ # get pdf text
123
  doc_list = []
124
 
125
  for file in docs: