10 Commits

6 changed files with 1542 additions and 60 deletions
+34
View File
@@ -0,0 +1,34 @@
FROM python:3.12-slim
RUN apt update && apt upgrade -y && apt install git -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# accept new ssh server
RUN sed /^StrictHostKeyChecking/d /etc/ssh/ssh_config; \
echo StrictHostKeyChecking no >> /etc/ssh/ssh_config
RUN --mount=type=cache,target=/root/.cache \
pip install poetry
RUN poetry config virtualenvs.create false
WORKDIR /app
# TODO: do not checkout the whole project; make auracast-translator-client(only) available as a package
RUN --mount=type=ssh,required=true \
git clone --single-branch --branch server_deployment ssh://git@ssh.pstruebi.xyz:222/auracaster/auracast-translator.git
# copy the app code
COPY . ./webui
# Install the dependencies
WORKDIR /app/webui
RUN poetry install --no-interaction --no-ansi
WORKDIR /app
# Expose Streamlit port
EXPOSE 8501
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Run the Streamlit app
CMD ["auracaster-webui"]
-19
View File
@@ -1,19 +0,0 @@
FROM python:3.12-slim
WORKDIR /app
# Copy only necessary files and directories
COPY src/auracaster_webui/ ./src/auracaster_webui/
COPY src/api_client/ ./src/api_client/
# Install the package
RUN pip install --no-cache-dir .
# Expose Streamlit port
EXPOSE 8501
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Run the Streamlit app
CMD ["auracaster-webui"]
+24
View File
@@ -0,0 +1,24 @@
services:
webui:
build:
context: .
dockerfile: Dockerfile
ssh:
- default=~/.ssh/id_ed25519 #lappi
ports:
- "8501:8501"
volumes:
- .:/app
environment:
- PYTHONUNBUFFERED=1
# Change this URL if the translator service is running on a different host
- TRANSLATOR_API_URL=http://translator:7999
restart: unless-stopped
# networks:
# - webui-network
# - translator-network
# Uncomment the below if you want the webui to depend on the translator
# when running the two services together
# depends_on:
# - translator
Generated
+1453
View File
File diff suppressed because it is too large Load Diff
+20 -35
View File
@@ -1,41 +1,26 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "auracaster"
[tool.poetry]
name = "auracaster-webui"
version = "0.1.0"
description = "Airport Announcement System"
authors = ["Patrick S <pstruebi>"]
description = "Announcement System"
readme = "README.md"
authors = [
{name = "Airport Team"}
]
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"streamlit>=1.25.0",
"requests>=2.28.0",
"fastapi>=0.95.0",
"uvicorn>=0.22.0",
"pydantic>=1.10.0",
"multilang-translator>=0.1.0" # TODO: this should only include
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
]
[tool.poetry.dependencies]
python = ">=3.12"
streamlit=">1.25.0"
requests=">2.28.0"
fastapi=">0.95.0"
uvicorn=">0.22.0"
pydantic=">1.10.0"
auracast-translator = {path = "../auracast-translator"}
[tool.setuptools]
package-dir = {"" = "src"}
[tool.poetry.dev-dependencies]
pytest=">7.0.0"
[tool.setuptools.packages.find]
where = ["src"]
[project.scripts]
auracaster-webui = "auracaster_webui.main:run_app"
[tool.poetry.scripts]
auracaster-webui = "auracaster_webui.main_ui:run_app"
auracaster-mock = "mock_backend.main:run_mock"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
+11 -6
View File
@@ -1,6 +1,7 @@
"""
Airport Announcement System Streamlit frontend application.
"""
import os
import streamlit as st
# Page setup must be first
@@ -8,11 +9,15 @@ st.set_page_config(page_title="Airport Announcement System", page_icon="✈️")
import time
import requests
from multilang_translator.translator_client.translator_client import (
import translator_client
from translator_client.translator_client import (
get_groups, get_available_languages, get_group_state,
start_announcement, update_group, get_available_endpoints
)
from multilang_translator.translator_models.translator_models import Endpoint, EndpointGroup, AnnouncementStates
from translator_models.translator_models import Endpoint, EndpointGroup, AnnouncementStates
if "TRANSLATOR_API_BASE_URL" in os.environ:
translator_client.translator_client.API_BASE_URL = os.getenv("TRANSLATOR_API_BASE_URL")
# Initialize session state for configuration
if "endpoint_groups" not in st.session_state:
@@ -32,7 +37,7 @@ if "available_languages" not in st.session_state:
# Initialize session state for announcement text and status tracking
if "announcement_text" not in st.session_state:
st.session_state.announcement_text = "Achtung bitte! Der Flug LH-2456 nach München ist jetzt zum Einsteigen bereit am Gate B12."
st.session_state.announcement_text = "Achtung bitte, Der Flug LH2456 nach München ist jetzt zum Einsteigen bereit am Gate B12 "
if "show_success_message" not in st.session_state:
st.session_state.show_success_message = False
if "announcement_id" not in st.session_state:
@@ -181,13 +186,13 @@ with st.container():
col1, col2, col3 = st.columns(3)
with col1:
if st.button("Letzter Aufruf"):
st.session_state.announcement_text = "Dies ist der letzte Aufruf für Flug LH-380 nach Berlin. Bitte begeben Sie sich sofort zum Gate B15."
st.session_state.announcement_text = "Dies ist der letzte Aufruf für Flug LH380 nach Berlin. Bitte begeben Sie sich sofort zum Gate B15"
with col2:
if st.button("Sicherheitshinweis"):
st.session_state.announcement_text = "Aus Sicherheitsgründen bitten wir Sie, Ihr Gepäck niemals unbeaufsichtigt zu lassen."
st.session_state.announcement_text = "Aus Sicherheitsgründen bitten wir Sie, Ihr Gepäck niemals unbeaufsichtigt zu lassen"
with col3:
if st.button("Verspätung"):
st.session_state.announcement_text = "Wir bedauern mitteilen zu müssen, dass sich der Flug LH-472 um 30 Minuten verspätet."
st.session_state.announcement_text = "Wir bedauern mitteilen zu müssen, dass sich der Flug LH472 um 30 Minuten verspätet"
# Custom announcement
with st.form("custom_announcement"):