Spaces:
Sleeping
Sleeping
Add requirements.txt and update Dockerfile
Browse files- Dockerfile +10 -20
- chat.py +1 -2
Dockerfile
CHANGED
|
@@ -1,28 +1,18 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.11.6
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 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
|
| 16 |
-
COPY
|
| 17 |
|
| 18 |
-
# Expose
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
-
# Set
|
| 22 |
-
|
| 23 |
-
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 24 |
-
ENV STREAMLIT_SERVER_ENABLECORS=false
|
| 25 |
-
ENV STREAMLIT_SERVER_ENABLEWEBUI=false
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
CMD ["streamlit", "run", "chat.py", "--server.port
|
|
|
|
| 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 |
-
|
| 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:
|