bmv2021 commited on
Commit
09ac7fa
Β·
1 Parent(s): 540424a

adjust streamlit rag app and dependencies files

Browse files

Co-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

Files changed (3) hide show
  1. Dockerfile +4 -4
  2. requirements.txt +10 -0
  3. streamlit-rag-app.py +4 -4
Dockerfile CHANGED
@@ -82,7 +82,7 @@ COPY --chown=user . /app
82
 
83
 
84
 
85
- # Set environment variables for Chainlit
86
 
87
 
88
 
@@ -94,12 +94,12 @@ ENV PORT=7860
94
 
95
 
96
 
97
- ENV CHAINLIT_SERVER_PORT=7860
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 ["chainlit", "run", "app.py","--port","7860"]
 
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="Football Players RAG App", page_icon="⚽")
53
- st.title("Football Players Knowledge Base πŸ†")
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("football_players.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,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 football players:")
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