Mobile application for Decentralized ML POC: Spotify Recommendation
This repo contains mobile applications to perform training on Spotify listening history.
The applications (Android / iOS) share code from a Kotlin/Native library under shared
.
The Android application currently does not contain code to actually perform learning.
Setup (iOS)
You will need the following:
- JDK & Gradle (for building shared library)
- Xcode 13+ (under Rosetta for M1 Macs)
- CocoaPods:
sudo gem install cocoapods
- cocoapods-generate plugin:
sudo gem install cocoapods-generate
- A modified version of SwiftSyt: Clone
https://github.com/datax-io/swiftsyft-parcel
branchparcel
to directoryswiftsyft-parcel
right next to this repo root. It is referenced inios/Podfile
.
- In
shared/src
, runsymlink.sh
to linkiosX64Main
asiosArm64Main
- In
shared
, perform Gradle sync. - In
ios
, runpod install
- Open
ios/App.xcworkspace
to run the app
Using the app
- Configure Spotify client ID and authorize your account
- Log into Spotify developer dashboard: https://developer.spotify.com/dashboard/applications
- Create an app. Any title would be fine.
- On the app detail page, record the Client ID displayed under the name of the app.
- Click "Edit Settings" to open the settings dialog. Under "Redirect URIs", add
spotifyrecommendationlab://spotifyauth
- Click "Users and Access" and add your own spotify account as a new user.
- Inside the app, next to "Spotify" > "Client ID", tap "Change" and paste the Client ID obtained from the developer dashboard.
- Tap "Authorize" to test the Spotify authorization.
- Tap "Fetch" to retrieve your listening history.
- Authorize your Oasis account.
- Inside the app, tap "Authorize" under "Parcel".
- Follow instructions on the screen to authorize the app to interact with Parcel on your behalf.
- Starting training
- Inside the app, tap "Train with API Data".
- A new screen should show. Training will start automatically with output similar to this:
Data source: API
Participant ID: 1
Data: 4067 tracks
Model: spotify_recommendation
Version: 1.0
connecting to ws://pygrid.dadtax.io:7001
Loading data, batch size = 64
Training...
Uploading diff...
Uploaded document
<<document-id>>
Reporting diff...
Done