diff --git a/backend/app.py b/backend/app.py index f9cbb7d8..d91717bd 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,6 +1,6 @@ from waitress import serve -from web import App +from backend.app import App app = App() diff --git a/backend/web/analyze_sleep.py b/backend/backend/analyze_sleep.py similarity index 93% rename from backend/web/analyze_sleep.py rename to backend/backend/analyze_sleep.py index 8915d853..bbe6c8f1 100644 --- a/backend/web/analyze_sleep.py +++ b/backend/backend/analyze_sleep.py @@ -10,10 +10,11 @@ from classification.model import SleepStagesClassifier from classification.features.preprocessing import preprocess -sleep_stage_classifier = SleepStagesClassifier() - class AnalyzeSleep: + def __init__(self): + self.sleep_stage_classifier = SleepStagesClassifier() + @staticmethod def _validate_file(file_content): if file_content is None: @@ -72,7 +73,7 @@ def on_post(self, request, response): return preprocessed_epochs = preprocess(classification_request) - predictions = sleep_stage_classifier.predict(preprocessed_epochs, classification_request) + predictions = self.sleep_stage_classifier.predict(preprocessed_epochs, classification_request) spectrogram_generator = SpectrogramGenerator(preprocessed_epochs) classification_response = ClassificationResponse( classification_request, predictions, spectrogram_generator.generate() diff --git a/backend/web/__init__.py b/backend/backend/app.py similarity index 72% rename from backend/web/__init__.py rename to backend/backend/app.py index 2cbef41b..9b272584 100644 --- a/backend/web/__init__.py +++ b/backend/backend/app.py @@ -1,7 +1,7 @@ import falcon -from web.ping import Ping -from web.analyze_sleep import AnalyzeSleep +from backend.ping import Ping +from backend.analyze_sleep import AnalyzeSleep def App(): diff --git a/backend/web/ping.py b/backend/backend/ping.py similarity index 100% rename from backend/web/ping.py rename to backend/backend/ping.py diff --git a/backend/readme.md b/backend/readme.md index b398b55c..90cc17b1 100644 --- a/backend/readme.md +++ b/backend/readme.md @@ -38,7 +38,7 @@ source venv/bin/activate If you want to run the backend with hot reload enabled (you must have installed the development requirements), run the following command. ```bash -hupper -m waitress app:app +hupper -m app ``` ## Run the tests