corentinm7 commited on
Commit
4748d54
Β·
verified Β·
1 Parent(s): a983571

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. Dockerfile +15 -5
  2. pages/SDH_staining.py +7 -13
  3. pyproject.toml +15 -0
  4. run.py +5 -10
Dockerfile CHANGED
@@ -1,5 +1,11 @@
1
  FROM python:3.12-slim-bullseye
 
2
 
 
 
 
 
 
3
 
4
  RUN apt-get update && apt-get install -y \
5
  build-essential \
@@ -8,16 +14,20 @@ RUN apt-get update && apt-get install -y \
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
11
  WORKDIR /app
12
- COPY requirements.txt /app/requirements.txt
 
 
 
 
13
  COPY pages /app/pages
14
  COPY run.py /app/run.py
15
-
16
- RUN pip3 install --upgrade pip
17
- RUN pip3 install -r requirements.txt
18
 
19
  EXPOSE 8501
20
 
21
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
22
 
23
- ENTRYPOINT ["streamlit", "run", "run.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.12-slim-bullseye
2
+ COPY --from=ghcr.io/astral-sh/uv:0.5.30 /uv /bin/uv
3
 
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV PYTHONIOENCODING=UTF-8
6
+ ENV UV_COMPILE_BYTECODE=1
7
+ ENV UV_NO_CACHE=1
8
+ ENV PATH="/app/.venv/bin:$PATH"
9
 
10
  RUN apt-get update && apt-get install -y \
11
  build-essential \
 
14
  git \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ RUN useradd -m -u 1000 user
18
+ USER user
19
  WORKDIR /app
20
+ RUN chown -R user:user /app
21
+ RUN chown -R user:user /home/user
22
+
23
+ COPY README.md /app/
24
+ COPY pyproject.toml /app/
25
  COPY pages /app/pages
26
  COPY run.py /app/run.py
27
+ RUN uv sync
 
 
28
 
29
  EXPOSE 8501
30
 
31
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
32
 
33
+ ENTRYPOINT ["uv", "run", "streamlit", "run", "run.py", "--server.port=8501", "--server.address=0.0.0.0"]
pages/SDH_staining.py CHANGED
@@ -33,8 +33,8 @@ use_GPU = is_gpu_availiable()
33
 
34
 
35
  @st.cache_resource
36
- def st_load_sdh_model(model_path):
37
- return load_sdh_model(model_path)
38
 
39
 
40
  @st.cache_resource
@@ -78,19 +78,13 @@ tf.random.set_seed(42)
78
  np.random.seed(42)
79
 
80
 
81
- if path.exists("model.h5"):
82
- st.success("SDH Model ready to use !")
83
- pass
84
- else:
85
- with st.spinner("Please wait we are downloading the SDH Model."):
86
- urllib.request.urlretrieve(
87
- "https://lbgi.fr/~meyer/SDH_models/model.h5", "model.h5"
88
- )
89
- st.success("SDH Model have been downloaded !")
90
 
91
- model_cellpose = st_load_cellpose()
 
92
 
93
- model_SDH = st_load_sdh_model("model.h5")
 
 
94
 
95
  st.title("SDH Staining Analysis")
96
  st.write(
 
33
 
34
 
35
  @st.cache_resource
36
+ def st_load_sdh_model():
37
+ return load_sdh_model()
38
 
39
 
40
  @st.cache_resource
 
78
  np.random.seed(42)
79
 
80
 
 
 
 
 
 
 
 
 
 
81
 
82
+ with st.spinner("Please wait we are loading the SDH Model."):
83
+ model_SDH = st_load_sdh_model()
84
 
85
+ st.success("SDH Model have been downloaded !")
86
+
87
+ model_cellpose = st_load_cellpose()
88
 
89
  st.title("SDH Staining Analysis")
90
  st.write(
pyproject.toml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "myoquant-streamlit"
3
+ version = "0.1.0"
4
+ description = ""
5
+ readme = "README.md"
6
+ requires-python = "<3.13, >=3.12"
7
+ dependencies = [
8
+ "myoquant>=0.3.8",
9
+ "streamlit",
10
+ "pandas",
11
+ "numpy",
12
+ "imageio",
13
+ "matplotlib",
14
+ "requests",
15
+ ]
run.py CHANGED
@@ -11,36 +11,31 @@ navigation_dict = {
11
  st.Page(
12
  page="pages/home.py",
13
  title="Home",
14
- icon="πŸ‘¨β€πŸ‘¨β€πŸ‘¦β€πŸ‘¦",
15
- url_path="home",
16
  default=True,
17
  ),
18
  st.Page(
19
  page="pages/ATP_staining.py",
20
  title="ATP Staining",
21
- icon="πŸ‘¨β€πŸ‘¨β€πŸ‘¦β€πŸ‘¦",
22
- url_path="atp_staining",
23
  default=False,
24
  ),
25
  st.Page(
26
  page="pages/HE_staining.py",
27
  title="HE Staining",
28
- icon="πŸ‘¨β€πŸ‘¨β€πŸ‘¦β€πŸ‘¦",
29
- url_path="he_staining",
30
  default=False,
31
  ),
32
  st.Page(
33
  page="pages/SDH_staining.py",
34
  title="SDH Staining",
35
- icon="πŸ‘¨β€πŸ‘¨β€πŸ‘¦β€πŸ‘¦",
36
- url_path="sdh_staining",
37
  default=False,
38
  ),
39
  st.Page(
40
  page="pages/Fluo_staining.py",
41
  title="Fluo Staining",
42
- icon="πŸ‘¨β€πŸ‘¨β€πŸ‘¦β€πŸ‘¦",
43
- url_path="fluo_staining",
44
  default=False,
45
  ),
46
  ],
 
11
  st.Page(
12
  page="pages/home.py",
13
  title="Home",
14
+ icon="🏠",
 
15
  default=True,
16
  ),
17
  st.Page(
18
  page="pages/ATP_staining.py",
19
  title="ATP Staining",
20
+ icon="🟣",
 
21
  default=False,
22
  ),
23
  st.Page(
24
  page="pages/HE_staining.py",
25
  title="HE Staining",
26
+ icon="πŸ”΄",
 
27
  default=False,
28
  ),
29
  st.Page(
30
  page="pages/SDH_staining.py",
31
  title="SDH Staining",
32
+ icon="πŸ”΅",
 
33
  default=False,
34
  ),
35
  st.Page(
36
  page="pages/Fluo_staining.py",
37
  title="Fluo Staining",
38
+ icon="🟒",
 
39
  default=False,
40
  ),
41
  ],