Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Dockerfile.dockerfile +24 -0
- app.py +20 -0
- requirements.txt +1 -0
Dockerfile.dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.11
|
| 2 |
+
# always create the user first and add
|
| 3 |
+
# to avoid the permission issue when editing the files later especially
|
| 4 |
+
# if you want to use the dev mode
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
# define the directory and install packages
|
| 7 |
+
WORKDIR /app
|
| 8 |
+
|
| 9 |
+
# copy the requirements to container and install them
|
| 10 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 11 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 12 |
+
# Copy the current directory contents into the container at /app setting the owner to the user
|
| 13 |
+
# also set the user as owner for root directory to enable update permissions
|
| 14 |
+
COPY --link --chown=1000 ./ /app
|
| 15 |
+
# app will need to expose the port for taking browser inputs
|
| 16 |
+
# make sure to have same port as mentioned in Readme.md
|
| 17 |
+
# rest of the code is from https://huggingface.co/spaces/SpacesExamples/streamlit-docker-example/blob/main/Dockerfile
|
| 18 |
+
# sepcific for streamlit docker
|
| 19 |
+
EXPOSE 8501
|
| 20 |
+
CMD streamlit run app.py \
|
| 21 |
+
--server.headless true \
|
| 22 |
+
--server.enableCORS false \
|
| 23 |
+
--server.enableXsrfProtection false \
|
| 24 |
+
--server.fileWatcherType none
|
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import stream as st
|
| 2 |
+
|
| 3 |
+
col_title, col_about = st.columns([8, 2])
|
| 4 |
+
with col_title:
|
| 5 |
+
st.markdown(
|
| 6 |
+
"<h1 style='text-align:center;'> Montreal AI Decisions (MVP)</h1>",
|
| 7 |
+
unsafe_allow_html=True
|
| 8 |
+
)
|
| 9 |
+
with col_about:
|
| 10 |
+
with st.expander("ℹ️ About this prototype"):
|
| 11 |
+
st.markdown(
|
| 12 |
+
"""
|
| 13 |
+
- **Data**: Public decisions under the Montreal Protocol.
|
| 14 |
+
- **Search**: Semantic (with a 0.3 cosine threshold).
|
| 15 |
+
- **RAG**: Answers generated with top-5 semantic search results as context.
|
| 16 |
+
⚠️ For testing only; do not input sensitive info.
|
| 17 |
+
AI answers may be incorrect or misleading.
|
| 18 |
+
""",
|
| 19 |
+
unsafe_allow_html=True
|
| 20 |
+
)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
streamlit==1.40.1
|