Rhodham96 commited on
Commit
cdf3e4e
·
1 Parent(s): cb9fb52

Add requirements.txt and update Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -20
  2. chat.py +1 -2
Dockerfile CHANGED
@@ -1,28 +1,18 @@
1
- # Use an official lightweight Python image
2
  FROM python:3.11.6
3
 
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Copy requirements file if you have one, else you can install directly
8
- # If you have a requirements.txt, uncomment the next two lines:
9
- # COPY requirements.txt .
10
- # RUN pip install --no-cache-dir -r requirements.txt
11
-
12
- # Install dependencies (add your actual dependencies here)
13
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
15
- # Copy the app code into the container
16
- COPY chat.py .
17
 
18
- # Expose Streamlit default port
19
  EXPOSE 7860
20
 
21
- # Set environment variables for Streamlit to run in the container
22
- ENV STREAMLIT_SERVER_PORT=7860
23
- ENV STREAMLIT_SERVER_HEADLESS=true
24
- ENV STREAMLIT_SERVER_ENABLECORS=false
25
- ENV STREAMLIT_SERVER_ENABLEWEBUI=false
26
 
27
- # Command to run the Streamlit app
28
- CMD ["streamlit", "run", "chat.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
+ # Use the official Python 3.11.6 image
2
  FROM python:3.11.6
3
 
4
+ # Install Streamlit and other dependencies
5
+ COPY requirements.txt .
 
 
 
 
 
 
 
6
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
7
 
8
+ # Copy the rest of the app
9
+ COPY . .
10
 
11
+ # Expose the port (optionnal, but cleaner)
12
  EXPOSE 7860
13
 
14
+ # Set the working directory
15
+ WORKDIR /
 
 
 
16
 
17
+ # Start the Streamlit app
18
+ CMD ["streamlit", "run", "chat.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
chat.py CHANGED
@@ -12,8 +12,7 @@ warnings.warn = warn
12
  warnings.filterwarnings('ignore')
13
 
14
  from langchain_community.document_loaders import PyPDFLoader
15
- import os
16
- os.system("pip install google-generativeai==0.8.5")
17
 
18
  # Initialize session state variables
19
  if "messages" not in st.session_state:
 
12
  warnings.filterwarnings('ignore')
13
 
14
  from langchain_community.document_loaders import PyPDFLoader
15
+
 
16
 
17
  # Initialize session state variables
18
  if "messages" not in st.session_state: