Table of Contents
This project is a web application built with Ruby on Rails. It includes a PostgreSQL database and Docker for containerization. The application is designed to manage tasks, providing features such as user authentication, task creation, and progress tracking.
Frontend:
Backend:
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
- Ruby version: 3.2.4
- Rails version: 7.1.3
- Docker version: 20.10.7
- PostgreSQL version: 13
The project uses several key dependencies, including:
- Rails 7.1.3
- PostgreSQL
- Docker
- RSpec for testing
- Webpacker for managing JavaScript
- Turbo and Stimulus for modern Rails development
- Python: ^3.10, <3.12
- Poetry Dependencies Manager for Python
For a complete list of dependencies, please refer to the Gemfile
in the project repository.
- Register: Users can register to create an account.
- Get the settings from Agora API: Configure the streaming settings using the Agora API.
- Stream: Start a live stream.
- Watch: View live streams.
- Record Stream: Record streams and save them to history.
- Join Telegram Channel: Get notified when a baby crying is detected.
- View History: Access manually recorded videos or automatically recorded videos when a baby cries, arranged by dates.
Clone the repository:
bash git clone https://github.com/Service-Design-Studio/1d-final-project-summer-2024-sds-2024-team-09.git
- Change directory to the repository:
cd 1d-final-project-summer-2024-sds-2024-team-09
- Install dependencies for rails:
bundle install
- Set up the database:
rails db:create rails db:migrate rails db:seed
- Run the Rails server:
rails server
- Build and run the Docker container: (deploy the program onto a cloud platform)
docker-compose up --build
- Change directory to the repository:
cd 1d-final-project-summer-2024-sds-2024-team-09/frontend
- Install dependencies for React:
npm install
- Run executes the dev script for React:
or deploy the program onto a cloud platform.
npm run dev
-
Installation:
cd 1d-final-project-summer-2024-sds-2024-team-09/ai_feature poetry install
-
Set up
baby_cry_AI
:- make a copy of example.env and fill up the necessary fields, including huggingface token and agora token
- additionally fill in agora token in ai_feature/recording_interval_updated/recording_interval_updated/templates/index.html
- setup Google Cloud SQL proxy https://cloud.google.com/sql/docs/mysql/sql-proxy
-
Run the recorder for AI detection: Change directory to the repository:
``` cd ai_feature ```
Connect to GCLoud SQL:
``` ./cloud_sql_proxy [your project id]:[your project region]:[your gcloud sql]-sql -p 5432 ```
Run detection for AI:
``` make run ```
Run recording function for detection:
``` cd recording_interval_updated/recording_interval_updated python to_record.py ```
-
Ensure Connectivity:
- Verify that all components (backend, AI system, front-end) are properly connected and communicating.
This project uses a combination of Cucumber for Behavior-Driven Development (BDD) testing and Jest for unit and integration testing of components.
To run the relevant tests, follow these steps:
-
Cucumber BDD Testing:
- The Cucumber BDD tests are located in the
features
directory. This includes the feature files written in Gherkin, step definitions, and any support files necessary for the BDD tests:C:\Users\Asus\T5 - SDS\T5-SDS\1d-final-project-summer-2024-sds-2024-team-09\features
- Running the Cucumber tests:
- Navigate to the project root:
cd C:\Users\Asus\T5 - SDS\T5-SDS\1d-final-project-summer-2024-sds-2024-team-09
- Run the Cucumber tests:
bundle exec cucumber
- This command will automatically detect and run all the tests in the
features
directory
- Navigate to the project root:
- The Cucumber BDD tests are located in the
-
Jest Testing:
- The Jest tests for the frontend components are located in the following directory:
C:\Users\Asus\T5 - SDS\T5-SDS\1d-final-project-summer-2024-sds-2024-team-09\frontend\src\components\__tests__
- Running the Jest tests:
- Navigate to the frontend directory:
cd C:\Users\Asus\T5 - SDS\T5-SDS\1d-final-project-summer-2024-sds-2024-team-09\frontend
- Run the Jest tests:
or
npm test
npx jest
- Navigate to the frontend directory:
- The Jest tests for the frontend components are located in the following directory:
![Logo](readme_img/Architecture.jpg)
This project is licensed under the CryBaby License.
CryBaby License
Copyright (c) [2024] [CryBaby]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For any inquiries, questions, or issues, please feel free to contact our team:
- [Tan Jing Kai]
- Email: [[email protected]]
- GitHub: [https://github.com/jingkai27]
- [Lee Jya Yin]
- Email: [[email protected]]
- GitHub: [https://github.com/jyayin]
- [Xiong Qian Long Mike]
- Email: [[email protected]]
- GitHub: [https://github.com/mikexql]
- [Sofeanna Binte Yusof]
- Email: [[email protected]]
- GitHub: [https://github.com/Sofeanna17]
- [Lim Sophie]
- Email: [[email protected]]
- GitHub: [https://github.com/shmoope]
- [Lim Sing Thai Tiger]
- Email: [[email protected]]
- GitHub: [https://github.com/Regitiger]
Data sources include: Ubenwa CryCeleb2023 ESC-50 Dataset for environmental sound classification, also featuring non-crying samples Audio clips downloaded from YouTube, such as this one Friends who were willing to record there babies crying
Preprocessing The raw audio files were processed into 4-second Mel Spectrogram clips using Librosa, which provides a two-dimensional representation of the sound based on the mel-scale frequencies. The preprocessing routine is integral to Cry Baby's runtime operations and is available here.
Model architecture The model's architecture is inspired by the design presented in this research paper. Below is a visualization of the model structure:
Training and evaluation
Training was conducted over 10 epochs with a batch size of 32. The corresponding training and validation loss and accuracy metrics are illustrated below.