Spaces:
Sleeping
Sleeping
Commit ·
a5c202c
1
Parent(s): cd6f412
Updated Dockerfile
Browse files- Dockerfile +58 -2
- src/streamlit_app.py +0 -40
Dockerfile
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
###############################################################################
|
| 2 |
# --------------------------- Stage 1: base image -------------------------- #
|
| 3 |
###############################################################################
|
|
@@ -31,8 +88,7 @@ RUN --mount=target=/app/requirements.txt,source=requirements.txt \
|
|
| 31 |
# --- Copy Application Code ---
|
| 32 |
# Copy all our application code into the container.
|
| 33 |
# Using --link can speed up builds on filesystems that support it.
|
| 34 |
-
|
| 35 |
-
COPY --link --chown=1000:1000 ./scripts ./scripts
|
| 36 |
|
| 37 |
# --- Create Writable Data Directory ---
|
| 38 |
# This is crucial for ChromaDB and the LangGraph checkpointer.
|
|
|
|
| 1 |
+
###############################################################################
|
| 2 |
+
# Base image – pick slim Python for a smaller footprint
|
| 3 |
+
###############################################################################
|
| 4 |
+
FROM python:3.10-slim
|
| 5 |
+
|
| 6 |
+
# --------------------------------------------------------------------------- #
|
| 7 |
+
# 1. General runtime settings #
|
| 8 |
+
# --------------------------------------------------------------------------- #
|
| 9 |
+
ENV PYTHONUNBUFFERED=1
|
| 10 |
+
ENV PIP_NO_CACHE_DIR=1
|
| 11 |
+
ENV HF_HOME=/hf
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# --------------------------------------------------------------------------- #
|
| 15 |
+
# 2. System packages often required by ML / CV libs & Streamlit front-ends #
|
| 16 |
+
# --------------------------------------------------------------------------- #
|
| 17 |
+
RUN apt-get update && \
|
| 18 |
+
apt-get install -y --no-install-recommends \
|
| 19 |
+
git git-lfs \ # for pulling large LFS blobs / models
|
| 20 |
+
ffmpeg libsm6 libxext6 \ # common for OpenCV / video / image ops
|
| 21 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 22 |
+
&& git lfs install
|
| 23 |
+
|
| 24 |
+
# --------------------------------------------------------------------------- #
|
| 25 |
+
# 3. Python deps #
|
| 26 |
+
# --------------------------------------------------------------------------- #
|
| 27 |
+
# a) First install *only* requirements.txt to leverage Docker layer caching
|
| 28 |
+
COPY requirements.txt .
|
| 29 |
+
RUN pip install --upgrade pip && pip install -r requirements.txt
|
| 30 |
+
|
| 31 |
+
# --------------------------------------------------------------------------- #
|
| 32 |
+
# 4. Project source #
|
| 33 |
+
# --------------------------------------------------------------------------- #
|
| 34 |
+
# Copy each top-level directory you showed in the screenshot
|
| 35 |
+
COPY --link --chown=1000:1000 ./frontend ./frontend
|
| 36 |
+
COPY --link --chown=1000:1000 ./data ./data
|
| 37 |
+
COPY --link --chown=1000:1000 ./insucompass ./insucompass
|
| 38 |
+
COPY --link --chown=1000:1000 ./scripts ./scripts
|
| 39 |
+
|
| 40 |
+
# If you need your SQLite DB, .env, etc. at runtime copy them, too
|
| 41 |
+
COPY insucompass.db .
|
| 42 |
+
|
| 43 |
+
# --------------------------------------------------------------------------- #
|
| 44 |
+
# 5. Ports & startup command #
|
| 45 |
+
# --------------------------------------------------------------------------- #
|
| 46 |
+
ENV PORT=7860
|
| 47 |
+
EXPOSE $PORT
|
| 48 |
+
|
| 49 |
+
# FastAPI app entry-point assumed at insucompass/main.py → app = FastAPI(...)
|
| 50 |
+
# Adjust the dotted path if your `FastAPI()` object lives elsewhere.
|
| 51 |
+
CMD ["uvicorn", "insucompass.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
###############################################################################
|
| 59 |
# --------------------------- Stage 1: base image -------------------------- #
|
| 60 |
###############################################################################
|
|
|
|
| 88 |
# --- Copy Application Code ---
|
| 89 |
# Copy all our application code into the container.
|
| 90 |
# Using --link can speed up builds on filesystems that support it.
|
| 91 |
+
|
|
|
|
| 92 |
|
| 93 |
# --- Create Writable Data Directory ---
|
| 94 |
# This is crucial for ChromaDB and the LangGraph checkpointer.
|
src/streamlit_app.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
import altair as alt
|
| 2 |
-
import numpy as np
|
| 3 |
-
import pandas as pd
|
| 4 |
-
import streamlit as st
|
| 5 |
-
|
| 6 |
-
"""
|
| 7 |
-
# Welcome to Streamlit!
|
| 8 |
-
|
| 9 |
-
Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.
|
| 10 |
-
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
| 11 |
-
forums](https://discuss.streamlit.io).
|
| 12 |
-
|
| 13 |
-
In the meantime, below is an example of what you can do with just a few lines of code:
|
| 14 |
-
"""
|
| 15 |
-
|
| 16 |
-
num_points = st.slider("Number of points in spiral", 1, 10000, 1100)
|
| 17 |
-
num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
|
| 18 |
-
|
| 19 |
-
indices = np.linspace(0, 1, num_points)
|
| 20 |
-
theta = 2 * np.pi * num_turns * indices
|
| 21 |
-
radius = indices
|
| 22 |
-
|
| 23 |
-
x = radius * np.cos(theta)
|
| 24 |
-
y = radius * np.sin(theta)
|
| 25 |
-
|
| 26 |
-
df = pd.DataFrame({
|
| 27 |
-
"x": x,
|
| 28 |
-
"y": y,
|
| 29 |
-
"idx": indices,
|
| 30 |
-
"rand": np.random.randn(num_points),
|
| 31 |
-
})
|
| 32 |
-
|
| 33 |
-
st.altair_chart(alt.Chart(df, height=700, width=700)
|
| 34 |
-
.mark_point(filled=True)
|
| 35 |
-
.encode(
|
| 36 |
-
x=alt.X("x", axis=None),
|
| 37 |
-
y=alt.Y("y", axis=None),
|
| 38 |
-
color=alt.Color("idx", legend=None, scale=alt.Scale()),
|
| 39 |
-
size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
|
| 40 |
-
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|