loader

[ad_1]

Recently, at Sovrn, we had an AI Hackathon where we were encouraged to experiment with anything related to machine learning. The Hackathon yielded some fantastic projects from across the company. Everything from SQL query generators to chatbots that can answer questions about our products and other incredible work. I thought this would be a great opportunity to learn more about Apple’s ML tools and maybe even build something with real business value.

A few of my colleagues and I teamed up to play with CreateML and CoreML to see if we could integrate some ML functionality into our iOS app. We got a model trained and integrated into our app in several hours, which was pretty amazing. But we quickly realized that we had a few problems to solve before we could actually ship this thing.

  • The model was hefty. It was about 50MB. That’s a lot of space to take up in our app bundle.
  • We wanted to update the model without releasing a new app version.
  • We wanted to use the model in the web browser as well.

We didn’t have time to solve all of these problems. But the other day I was exploring the Vapor web framework and the thought hit me, “Why not deploy CoreML models on the server?”

Apple provides a few pre-trained models, so today we’ll deploy an image classification model on the server behind a REST API with Vapor and create a SwiftUI client to consume it.

This prototype is just that, a prototype. It’s not meant to be a production-ready solution. It’s meant to be a proof of concept. There will be warnings in the console, and the code won’t be very clean, but it will work and hopefully get your wheels turning.

If you want to skip all this, or if you do want to follow along, you can find the source code for this project on GitHub.

Okay, disclaimers over. Let’s get started!

  • Xcode 15
  • macOS 14
  • Homebrew
  • Apple Developer Account + Physical Device for testing

[ad_2]

Source link