Skip to content

Commit a6aa6f9

Browse files
Prettier UI; removed comments; [skip ci]
Improved UI by adding background colors to the result text areas for pipelines and scripts, indicating success (green) or error (red) based on the presence of an "error" key in the result. Removed some parts of the comments from docker-related files.
1 parent 94cb3fc commit a6aa6f9

4 files changed

Lines changed: 28 additions & 16 deletions

File tree

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# For faster development iterations, consider using a local Conda environment on your machine with the
66
# same environment.yml file.
77

8-
# ===== Base image with GPU support =====
8+
# Base image with GPU support
99
FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
1010
# NOTE: Uncomment the line below and comment out the line above only if you want to generate fake data.
1111
# For regular use, stick to the current image. If you use the image below, make sure to also uncomment
@@ -14,14 +14,14 @@ FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
1414

1515
# FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04
1616

17-
# ===== Set working directory =====
17+
# Set working directory
1818
WORKDIR /app
1919

20-
# ===== Timezone fix =====
20+
# Timezone fix
2121
ENV TZ=Europe/Zagreb
2222
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2323

24-
# ===== Install Miniconda and Git =====
24+
# Install Miniconda and Git
2525
RUN apt-get update && apt-get install -y wget bzip2 git && \
2626
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
2727
bash /tmp/miniconda.sh -b -p /opt/conda && \
@@ -31,14 +31,14 @@ RUN apt-get update && apt-get install -y wget bzip2 git && \
3131
# Add conda to PATH
3232
ENV PATH="/opt/conda/bin:$PATH"
3333

34-
# ===== Accept Conda Terms of Service =====
34+
# Accept Conda Terms of Service
3535
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
3636
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
3737

38-
# ===== Copy environment.yml first for faster rebuilds =====
38+
# Copy environment.yml first for faster rebuilds
3939
COPY environment.yml /tmp/environment.yml
4040

41-
# ===== Create Conda environment =====
41+
# Create Conda environment
4242
# Create env
4343
RUN conda env create -f /tmp/environment.yml -n hotel_management
4444

@@ -61,10 +61,10 @@ COPY pyproject.toml .
6161
# Install rest
6262
RUN conda run -n hotel_management pip install -r /tmp/requirements.txt
6363

64-
# ===== Use the environment for all container commands =====
64+
# Use the environment for all container commands
6565
SHELL ["conda", "run", "-n", "hotel_management", "/bin/bash", "-c"]
6666

67-
# ===== Copy the code =====
67+
# Copy the code
6868
COPY ml ./ml
6969
COPY pipelines ./pipelines
7070
COPY scripts ./scripts
@@ -73,11 +73,11 @@ COPY ml_service ./ml_service
7373
# Install the package
7474
RUN conda run -n hotel_management pip install -e .
7575

76-
# ===== Expose ports =====
76+
# Expose ports
7777
EXPOSE 8000
7878
EXPOSE 8050
7979

80-
# ===== Run all services =====
80+
# Run all services
8181
CMD bash -c "\
8282
uvicorn ml_service.backend.main:app --reload --host 0.0.0.0 --port 8000 & \
8383
python -m ml_service.frontend.app --host 0.0.0.0 --port 8050 & \

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
context: .
55
tty: true
66
stdin_open: true
7-
# ===== GPU support =====
7+
# GPU support
88
deploy:
99
resources:
1010
reservations:

ml_service/frontend/pipelines/callbacks.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,18 @@ def run_pipeline(n_clicks, *values):
7373
print("Payload sent:", payload)
7474
result = call_pipeline(pipeline["endpoint"], payload)
7575

76+
bg_color="#81ff81" if not result.get("error") else "#ff8181"
77+
7678
return dbc.Textarea(
7779
value=str(result),
78-
style={"width": "100%", "height": "200px"},
80+
style={
81+
"width": "100%",
82+
"height": "200px",
83+
"backgroundColor": bg_color
84+
},
7985
className="mt-2",
8086
id=f"{PAGE_PREFIX}-{pipeline['name']}-result",
81-
name=f"{PAGE_PREFIX}-{pipeline['name']}-result"
87+
name=f"{PAGE_PREFIX}-{pipeline['name']}-result",
8288
)
8389

8490
for p in FRONTEND_PIPELINES:

ml_service/frontend/scripts/callbacks.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,18 @@ def run_pipeline(n_clicks, *values):
7676
print("Payload sent:", payload)
7777
result = call_script(script["endpoint"], payload)
7878

79+
bg_color="#81ff81" if not result.get("error") else "#ff8181"
80+
7981
return dbc.Textarea(
8082
value=str(result),
81-
style={"width": "100%", "height": "200px"},
83+
style={
84+
"width": "100%",
85+
"height": "200px",
86+
"backgroundColor": bg_color
87+
},
8288
className="mt-2",
8389
id=f"{PAGE_PREFIX}-{script['name']}-result",
84-
name=f"{PAGE_PREFIX}-{script['name']}-result"
90+
name=f"{PAGE_PREFIX}-{script['name']}-result",
8591
)
8692

8793
for s in FRONTEND_SCRIPTS:

0 commit comments

Comments
 (0)