Welcome to the CreateML Audio Classifier Workshop! 🎵 This hands-on exercise will guide you through creating an iOS app that classifies audio genres using CreateML and enhances the user experience by integrating the GIPHY API for visual feedback.
In this workshop, participants will:
-
Train an Audio Classifier Model: Use the CreateML framework and the GTZAN dataset to build a machine learning model that classifies audio genres.
-
Integrate the Model into an iOS App: Process live microphone input to classify audio genres in real time.
-
Enhance UX with GIPHY: Dynamically fetch and display GIPHY stickers related to the identified audio genre.
This repository contains two branches:
-
**starter**
: The starting point for the workshop. Participants will complete key areas of the code marked with//TODO: Complete this
. -
**main**
: The complete solution for reference.
Clone the branch of your choice:
# Clone the starter branch to follow along
git clone -b starter https://github.com/Adolfo-David-Romero/Workshop-CreateML.git
# Clone the main branch to see the complete solution
git clone -b main https://github.com/Adolfo-David-Romero/Workshop-CreateML.git
Before you begin, ensure you have the following:
-
Xcode 14+ installed on macOS.
-
Basic knowledge of Swift and SwiftUI.
-
CreateML: Pre-installed as part of Xcode.
-
GIPHY API Key: Sign up at GIPHY Developers to get an API key.
-
GTZAN Dataset: Download the dataset from GTZAN for training the model.
-
Open CreateML in Xcode.
-
Use the GTZAN dataset to create an audio classification model that distinguishes genres like Rock, Jazz, Pop, etc.
-
Export the trained
.mlmodel
file and add it to theResources
folder of the Xcode project.
-
Open the
starter
branch in Xcode. -
Complete the
//TODO: Complete this
, or//FIXME: Fix this
sections in the code, which cover:-
Initializing the CoreML model.
-
Processing live audio input into the correct format for predictions.
-
Performing predictions and handling results.
-
Fetching genre-specific GIPHY stickers via the GIPHY API.
-
-
Use the provided PredictionView and HomeView to test the app.
-
Build and run the app on a simulator or physical device.
-
Speak or play audio near the microphone and watch the app classify the genre in real-time.
-
View related GIPHY stickers displayed dynamically at the bottom of the screen.
-
Real-Time Audio Classification: Uses CoreML and CreateML for live audio analysis.
-
Dynamic Sticker Display: Integrates the GIPHY API to fetch and display stickers based on detected genres.
-
Reusable UI Components: Modularized SwiftUI views for easy customization.
The project uses the following:
-
CreateML: For training the audio classifier.
-
CoreML: For integrating the trained model into the app.
-
GIPHY API: For fetching genre-specific stickers.
By the end of this workshop, participants will:
-
Understand how to train a machine learning model with CreateML.
-
Integrate a CoreML model into an iOS app for live predictions.
-
Use a third-party API (GIPHY) to enhance user experience.
-
Follow best practices for modular SwiftUI and MVVM architecture.
Feel free to open issues or submit pull requests to improve this repository. Contributions are always welcome!
This project is licensed under the MIT License.