Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c116d666f | |||
| 760ef69c44 | |||
| 4c5242dca3 | |||
| 03585726b5 | |||
| 61a9a64fa5 | |||
| 6162cae6fd | |||
| f4529f734e | |||
| d558a1bc3d | |||
| 79d0586d3e | |||
| 3c85bc387d |
+34
@@ -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"]
|
||||||
@@ -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"]
|
|
||||||
@@ -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
File diff suppressed because it is too large
Load Diff
+20
-35
@@ -1,41 +1,26 @@
|
|||||||
[build-system]
|
[tool.poetry]
|
||||||
requires = ["setuptools>=61.0", "wheel"]
|
name = "auracaster-webui"
|
||||||
build-backend = "setuptools.build_meta"
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "auracaster"
|
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Airport Announcement System"
|
authors = ["Patrick S <pstruebi>"]
|
||||||
|
description = "Announcement System"
|
||||||
readme = "README.md"
|
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]
|
[tool.poetry.dependencies]
|
||||||
dev = [
|
python = ">=3.12"
|
||||||
"pytest>=7.0.0",
|
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]
|
[tool.poetry.dev-dependencies]
|
||||||
package-dir = {"" = "src"}
|
pytest=">7.0.0"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.poetry.scripts]
|
||||||
where = ["src"]
|
auracaster-webui = "auracaster_webui.main_ui:run_app"
|
||||||
|
|
||||||
[project.scripts]
|
|
||||||
auracaster-webui = "auracaster_webui.main:run_app"
|
|
||||||
auracaster-mock = "mock_backend.main:run_mock"
|
auracaster-mock = "mock_backend.main:run_mock"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Airport Announcement System Streamlit frontend application.
|
Airport Announcement System Streamlit frontend application.
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
|
||||||
# Page setup must be first
|
# Page setup must be first
|
||||||
@@ -8,11 +9,15 @@ st.set_page_config(page_title="Airport Announcement System", page_icon="✈️")
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import requests
|
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,
|
get_groups, get_available_languages, get_group_state,
|
||||||
start_announcement, update_group, get_available_endpoints
|
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
|
# Initialize session state for configuration
|
||||||
if "endpoint_groups" not in st.session_state:
|
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
|
# Initialize session state for announcement text and status tracking
|
||||||
if "announcement_text" not in st.session_state:
|
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:
|
if "show_success_message" not in st.session_state:
|
||||||
st.session_state.show_success_message = False
|
st.session_state.show_success_message = False
|
||||||
if "announcement_id" not in st.session_state:
|
if "announcement_id" not in st.session_state:
|
||||||
@@ -181,13 +186,13 @@ with st.container():
|
|||||||
col1, col2, col3 = st.columns(3)
|
col1, col2, col3 = st.columns(3)
|
||||||
with col1:
|
with col1:
|
||||||
if st.button("Letzter Aufruf"):
|
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:
|
with col2:
|
||||||
if st.button("Sicherheitshinweis"):
|
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:
|
with col3:
|
||||||
if st.button("Verspätung"):
|
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
|
# Custom announcement
|
||||||
with st.form("custom_announcement"):
|
with st.form("custom_announcement"):
|
||||||
|
|||||||
Reference in New Issue
Block a user