From 3ff50a3f98e39a7a3327508740bce0efa52d208d Mon Sep 17 00:00:00 2001 From: Mauro Luzzatto Date: Sun, 5 Nov 2023 21:13:08 +0100 Subject: [PATCH] fix css in the app --- app/static/css/styles.css | 8 +++++--- app/templates/shared/base.html | 6 ++---- main.py | 18 +++++++----------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/static/css/styles.css b/app/static/css/styles.css index 363a0d9..0d1809b 100755 --- a/app/static/css/styles.css +++ b/app/static/css/styles.css @@ -10,7 +10,9 @@ body { color: rgba(0, 0, 0, 0.8); margin: 0; padding: 0; - font-weight: 330 + font-weight: 330; + /* background-color:#faf0e6; */ + } html { @@ -158,7 +160,7 @@ pre code { -moz-user-select: none; user-select: none } - +/* .post { padding: 3rem 0; font-size: 0.7rem; @@ -213,7 +215,7 @@ pre code { .post a:hover { text-decoration: underline -} +} */ /* diff --git a/app/templates/shared/base.html b/app/templates/shared/base.html index 1399953..6921313 100755 --- a/app/templates/shared/base.html +++ b/app/templates/shared/base.html @@ -14,10 +14,8 @@ - - + + diff --git a/main.py b/main.py index 882e465..9804a23 100755 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ from app.utils.response_messages import get_exception_details from app.utils.runtime import get_is_lambda_runtime from music_flow import Predictor, get_formatted_features -from music_flow.config.core import model_settings +from music_flow.config import model_settings from music_flow.core.utils import path_app logger = logging.getLogger(__name__) @@ -71,6 +71,10 @@ async def lifespan(app: FastAPI): servers=[{"url": settings.ROOT_PATH}], ) +path_static = str(Path(path_app).absolute() / "static") +app.mount("/static", StaticFiles(directory=path_static), name="static") + + app.add_middleware( Analytics, is_lambda_runtime=is_lambda_runtime, is_testing=is_testing ) @@ -78,14 +82,6 @@ async def lifespan(app: FastAPI): app.include_router(root.router) -base_path = Path(path_app).absolute() -path_static = str(base_path / "static") -logger.debug(f"Base path: {base_path}") -logger.debug(f"static: {path_static}") - -app.mount("/static", StaticFiles(directory=path_static), name="static") - - @app.get("/api/prediction/", tags=["API"]) async def get_prediction_api(song: str, artist: str) -> Prediction: """Get the model predictions @@ -144,12 +140,12 @@ async def get_prediction_api(song: str, artist: str) -> Prediction: save_name=f"{save_folder}/{name}.json", ) - data_enrichted = { + data_enriched = { "description": settings.PREDICTION_DESCRIPTION, "message": user_message, "preview_url": raw_features["track"]["preview_url"], } - data_response.update(data_enrichted) + data_response.update(data_enriched) return Prediction(**data_response)