Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
127 |
-
|
|
|
|
|
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 |
+
|