Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import streamlit as st
|
2 |
-
from dotenv import load_dotenv
|
3 |
import pickle
|
4 |
from PyPDF2 import PdfReader
|
5 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
@@ -35,7 +34,7 @@ with st.sidebar:
|
|
35 |
add_vertical_space(3) # Add more vertical space between text blocks
|
36 |
st.write('Made with ❤️ by Anne')
|
37 |
|
38 |
-
|
39 |
|
40 |
def load_pdf(file_path):
|
41 |
pdf_reader = PdfReader(file_path)
|
@@ -63,8 +62,11 @@ def load_pdf(file_path):
|
|
63 |
|
64 |
return VectorStore
|
65 |
|
66 |
-
def load_chatbot():
|
67 |
-
|
|
|
|
|
|
|
68 |
|
69 |
def main():
|
70 |
st.title("BinDocs Chat App")
|
|
|
1 |
import streamlit as st
|
|
|
2 |
import pickle
|
3 |
from PyPDF2 import PdfReader
|
4 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
|
|
34 |
add_vertical_space(3) # Add more vertical space between text blocks
|
35 |
st.write('Made with ❤️ by Anne')
|
36 |
|
37 |
+
openai_api_key = st.text_input("Enter your OpenAI API key:")
|
38 |
|
39 |
def load_pdf(file_path):
|
40 |
pdf_reader = PdfReader(file_path)
|
|
|
62 |
|
63 |
return VectorStore
|
64 |
|
65 |
+
def load_chatbot(openai_api_key):
|
66 |
+
openai_config = {
|
67 |
+
"api_key": openai_api_key
|
68 |
+
}
|
69 |
+
return load_qa_chain(llm=OpenAI(config=openai_config), chain_type="stuff")
|
70 |
|
71 |
def main():
|
72 |
st.title("BinDocs Chat App")
|