Samuel Oberhofer commited on
Commit
8667d97
·
1 Parent(s): 5ba327c

refactor: automate setup and streamline Docker deployment

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -5
  2. app.py +15 -0
  3. startup.sh +0 -4
Dockerfile CHANGED
@@ -19,11 +19,8 @@ USER user
19
  # Install dependencies
20
  RUN pip install --user -r requirements.txt
21
 
22
- # Make the startup script executable
23
- RUN chmod +x startup.sh
24
-
25
  # Add the user's local bin directory to the PATH
26
  ENV PATH="/home/user/.local/bin:${PATH}"
27
 
28
- # Set the entrypoint to the startup script
29
- CMD ["./startup.sh"]
 
19
  # Install dependencies
20
  RUN pip install --user -r requirements.txt
21
 
 
 
 
22
  # Add the user's local bin directory to the PATH
23
  ENV PATH="/home/user/.local/bin:${PATH}"
24
 
25
+ # Set the entrypoint to the Streamlit app
26
+ CMD ["streamlit", "run", "app.py"]
app.py CHANGED
@@ -12,6 +12,20 @@ from helper import ROLE_ASSISTANT, AUTO_ANSWERS, sanitize
12
  from rag import retriever
13
  from dataclasses import dataclass
14
  from typing import List
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  # ============================================
17
  # BACKEND INTEGRATION
@@ -92,6 +106,7 @@ def query_rag_pipeline(user_query: str, model: RAGModel, output_guardRails: Outp
92
  # ============================================
93
 
94
  def main():
 
95
  st.set_page_config(
96
  page_title="Knowledge Retrieval System",
97
  page_icon="🤖",
 
12
  from rag import retriever
13
  from dataclasses import dataclass
14
  from typing import List
15
+ from database.setup_db import setup_database
16
+ from rag.build_vector_store import build_vector_store
17
+
18
+ # ============================================
19
+ # APPLICATION SETUP
20
+ # ============================================
21
+
22
+ @st.cache_resource
23
+ def setup_application():
24
+ """
25
+ Sets up the database and vector store on application startup.
26
+ """
27
+ setup_database()
28
+ build_vector_store()
29
 
30
  # ============================================
31
  # BACKEND INTEGRATION
 
106
  # ============================================
107
 
108
  def main():
109
+ setup_application()
110
  st.set_page_config(
111
  page_title="Knowledge Retrieval System",
112
  page_icon="🤖",
startup.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Run the Streamlit app
4
- streamlit run app.py