Spaces:
Running
Running
adjust streamlit rag app and dependencies files
Browse filesCo-authored-by: Brandon Vargus bmv2021@bu.edu
Co-authored-by: Daniel Foley daf@bu.edu
Co-authored-by: Jinanshi Mehta jinanshi@bu.edu
Co-authored-by: Enrico Collautti enricoll@bu.edu
- Dockerfile +4 -4
- requirements.txt +10 -0
- streamlit-rag-app.py +4 -4
Dockerfile
CHANGED
@@ -82,7 +82,7 @@ COPY --chown=user . /app
|
|
82 |
|
83 |
|
84 |
|
85 |
-
# Set environment variables for
|
86 |
|
87 |
|
88 |
|
@@ -94,12 +94,12 @@ ENV PORT=7860
|
|
94 |
|
95 |
|
96 |
|
97 |
-
ENV
|
98 |
|
99 |
|
100 |
|
101 |
-
ENV CHAINLIT_HOST="0.0.0.0"
|
102 |
|
|
|
103 |
|
104 |
|
105 |
|
@@ -108,4 +108,4 @@ ENV CHAINLIT_HOST="0.0.0.0"
|
|
108 |
|
109 |
# Change the CMD to use chainlit
|
110 |
|
111 |
-
CMD ["
|
|
|
82 |
|
83 |
|
84 |
|
85 |
+
# Set environment variables for Streamlit
|
86 |
|
87 |
|
88 |
|
|
|
94 |
|
95 |
|
96 |
|
97 |
+
ENV STREAMLIT_SERVER_PORT=7860
|
98 |
|
99 |
|
100 |
|
|
|
101 |
|
102 |
+
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
103 |
|
104 |
|
105 |
|
|
|
108 |
|
109 |
# Change the CMD to use chainlit
|
110 |
|
111 |
+
CMD ["streamlit", "run", "streamlit-rag-app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
|
requirements.txt
CHANGED
@@ -9,3 +9,13 @@ pydantic==2.7.3
|
|
9 |
pydantic-settings==2.6.1
|
10 |
|
11 |
pydantic_core==2.18.4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
pydantic-settings==2.6.1
|
10 |
|
11 |
pydantic_core==2.18.4
|
12 |
+
|
13 |
+
sentence_transformers
|
14 |
+
|
15 |
+
streamlit
|
16 |
+
|
17 |
+
python-dotenv
|
18 |
+
|
19 |
+
openai
|
20 |
+
|
21 |
+
faiss-cpu
|
streamlit-rag-app.py
CHANGED
@@ -49,15 +49,15 @@ def setup_qa_chain(vector_store):
|
|
49 |
|
50 |
def main():
|
51 |
# Set page title and header
|
52 |
-
st.set_page_config(page_title="
|
53 |
-
st.title("
|
54 |
|
55 |
# Sidebar for initialization
|
56 |
st.sidebar.header("Initialize Knowledge Base")
|
57 |
if st.sidebar.button("Load Data"):
|
58 |
try:
|
59 |
# Load and preprocess the JSON file
|
60 |
-
json_data = load_json_file("
|
61 |
st.session_state.vector_store = setup_vector_store_from_json(json_data)
|
62 |
st.session_state.qa_chain = setup_qa_chain(st.session_state.vector_store)
|
63 |
st.sidebar.success("Knowledge base loaded successfully!")
|
@@ -66,7 +66,7 @@ def main():
|
|
66 |
|
67 |
# Query input and processing
|
68 |
st.header("Ask a Question")
|
69 |
-
query = st.text_input("Enter your question about
|
70 |
|
71 |
if query:
|
72 |
# Check if vector store and QA chain are initialized
|
|
|
49 |
|
50 |
def main():
|
51 |
# Set page title and header
|
52 |
+
st.set_page_config(page_title="LibRAG, page_icon="π")
|
53 |
+
st.title("Boston Public Library Database π")
|
54 |
|
55 |
# Sidebar for initialization
|
56 |
st.sidebar.header("Initialize Knowledge Base")
|
57 |
if st.sidebar.button("Load Data"):
|
58 |
try:
|
59 |
# Load and preprocess the JSON file
|
60 |
+
json_data = load_json_file(".json")
|
61 |
st.session_state.vector_store = setup_vector_store_from_json(json_data)
|
62 |
st.session_state.qa_chain = setup_qa_chain(st.session_state.vector_store)
|
63 |
st.sidebar.success("Knowledge base loaded successfully!")
|
|
|
66 |
|
67 |
# Query input and processing
|
68 |
st.header("Ask a Question")
|
69 |
+
query = st.text_input("Enter your question about BPL's database")
|
70 |
|
71 |
if query:
|
72 |
# Check if vector store and QA chain are initialized
|