nijoow commited on
Commit
d6c66ed
Β·
1 Parent(s): abbcb3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -95,7 +95,7 @@ def get_conversation_chain(vectorstore):
95
  return conversation_chain
96
 
97
  # μ‚¬μš©μž μž…λ ₯을 μ²˜λ¦¬ν•˜λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
98
- def handle_userinput(user_question):
99
  # λŒ€ν™” 체인을 μ‚¬μš©ν•˜μ—¬ μ‚¬μš©μž μ§ˆλ¬Έμ— λŒ€ν•œ 응닡을 μƒμ„±ν•©λ‹ˆλ‹€.
100
  response = st.session_state.conversation({'question': user_question})
101
  # λŒ€ν™” 기둝을 μ €μž₯ν•©λ‹ˆλ‹€.
@@ -123,8 +123,10 @@ def main():
123
 
124
  st.header("Chat with multiple Files :")
125
  user_question = st.text_input("Ask a question about your documents:")
126
- if user_question:
127
- handle_userinput(user_question)
 
 
128
 
129
  with st.sidebar:
130
  openai_key = st.text_input("Paste your OpenAI API key (sk-...)")
@@ -132,8 +134,6 @@ def main():
132
  os.environ["OPENAI_API_KEY"] = openai_key
133
 
134
  st.subheader("Your documents")
135
- docs = st.file_uploader(
136
- "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
137
  if st.button("Process"):
138
  with st.spinner("Processing"):
139
  # get pdf text
@@ -167,3 +167,4 @@ def main():
167
 
168
  if __name__ == '__main__':
169
  main()
 
 
95
  return conversation_chain
96
 
97
  # μ‚¬μš©μž μž…λ ₯을 μ²˜λ¦¬ν•˜λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
98
+ def handle_userinput(user_question, docs):
99
  # λŒ€ν™” 체인을 μ‚¬μš©ν•˜μ—¬ μ‚¬μš©μž μ§ˆλ¬Έμ— λŒ€ν•œ 응닡을 μƒμ„±ν•©λ‹ˆλ‹€.
100
  response = st.session_state.conversation({'question': user_question})
101
  # λŒ€ν™” 기둝을 μ €μž₯ν•©λ‹ˆλ‹€.
 
123
 
124
  st.header("Chat with multiple Files :")
125
  user_question = st.text_input("Ask a question about your documents:")
126
+ docs = st.file_uploader(
127
+ "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
128
+ if user_question and docs:
129
+ handle_userinput(user_question, docs)
130
 
131
  with st.sidebar:
132
  openai_key = st.text_input("Paste your OpenAI API key (sk-...)")
 
134
  os.environ["OPENAI_API_KEY"] = openai_key
135
 
136
  st.subheader("Your documents")
 
 
137
  if st.button("Process"):
138
  with st.spinner("Processing"):
139
  # get pdf text
 
167
 
168
  if __name__ == '__main__':
169
  main()
170
+