◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/AI Models
◉ AI Models/2026-07-15Advanced

On-Device Image Classification: TFLite on React Native or Core ML on Rork Max — How I Chose After Building Both

Adding on-device image classification means choosing between TFLite on React Native and Core ML on Rork Max. I built the same feature both ways, measured the end-to-end breakdown, and worked out what the decision actually hinges on.

Rork Max236Core ML6TensorFlow LiteOn-Device AI6React Native239Expo219Image Recognition

✦ Premium Article

Pick a photo, and the app decides on its own whether it is a night scene, a sky, or an abstract pattern — entirely on the device. When I went to add that small classifier to a wallpaper app, what stopped me was not the choice of model.

Do I bolt TensorFlow Lite onto the React Native (Expo) project that regular Rork produces? Or do I lean on the native Swift that Rork Max emits and go with Core ML?

The pricing gap matters too. Regular Rork starts free with paid plans at $25/month; Rork Max is $200/month. For a solo developer, that spread is not pocket change.

So I built the same feature both ways. What I learned is that the thing I had been trying to compare — inference engine speed — was the wrong variable entirely.

Three questions I settled before writing any code

Deciding these first matters. Skip them and you end up picking whichever one happened to work.

  1. Can the user wait for a result? Snapping one photo and classifying it is a different problem from tracking a live camera preview.
  2. Will I keep swapping the model? Shipping one off-the-shelf classifier is not the same as retraining on my own data and pushing updates.
  3. What else on the device will I want to reach for? Six months out, will widgets or the deeper parts of the photo library start looking tempting?

That third question turned out to be the one that decided it.

On React Native, "use TFLite" is not a single path

Start with the React Native (Expo) foundation that regular Rork generates. The first fork appears immediately.

You can go through the TensorFlow.js React Native bindings, or you can hit native TFLite directly over JSI. Both are "using TFLite," and they feel nothing alike in practice.

AspectVia tfjs-react-nativeDirect over JSI (react-native-fast-tflite and friends)
How the image travelsFile to Base64 string to Uint8Array to tensorArrayBuffer passed with close to zero copying
Where preprocessing livesIn JS — resize and normalize are tensor opsPushed to native or a frame processor
Ease of setupTestable in Expo GoRequires a development build
Where it bitesBase64 round trip, GC pressure, leaked tensorsMismatched model input specs and dtypes

Convenience won at first, so I built the tfjs route. It works. It genuinely works. But there was a beat of hesitation between pressing the shutter and seeing a result, and it never went away.

The easy path, and the thing that kept nagging

// utils/classifyViaTfjs.ts
import * as tf from '@tensorflow/tfjs';
import { decodeJpeg } from '@tensorflow/tfjs-react-native';
import * as FileSystem from 'expo-file-system';
 
// The image becomes a *string* and then gets read back. Remember this line.
export async function classifyViaTfjs(model: tf.GraphModel, uri: string) {
  const b64 = await FileSystem.readAsStringAsync(uri, {
    encoding: FileSystem.EncodingType.Base64,
  });
 
  const bytes = tf.util.encodeString(b64, 'base64');
  const image = decodeJpeg(new Uint8Array(bytes.buffer));
 
  // Down to 224x224, normalize to -1..1, add the batch dimension
  const input = tf.tidy(() =>
    tf.image.resizeBilinear(image, [224, 224]).div(127.5).sub(1).expandDims(0)
  );
 
  const logits = model.predict(input) as tf.Tensor;
  const probs = await logits.data();
 
  // tidy cannot span an await, so anything created outside it is yours to free
  tf.dispose([image, input, logits]);
 
  return probs;
}

The tf.tidy wrapper reclaims intermediate tensors in one sweep. It cannot cross an await, though, so decodeJpeg output and predict output still need an explicit dispose. Miss that and memory starts visibly climbing somewhere around the fortieth image.

The reason this deserves care: a leak like this is invisible during the ten images you test with. It shows up when a user scrolls an album for a while.

But the real problem was not the leak — it was how the image traveled. File to Base64 string, across the JS bridge, back to a Uint8Array. A 2MB photo becomes roughly a 2.7MB string the moment you Base64 it.

Inference was fast, and I was still waiting. That told me what to measure.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Why preprocessing and data handoff dominate the timeline instead of inference, plus a probe you can drop in to get the breakdown on your own device
✦The two routes for shipping TFLite (via tfjs versus via JSI) and the exact place where one of them stalls
✦A decision table for when the jump from $25/month to $200/month is actually justified, derived from feature requirements rather than benchmarks
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◉ AI Models2026-09-12
Ask Rork for an iOS 27 feature and you may get last year's code back, with no error at all
iOS 27 ships on September 14. When a model is asked for an API it has never seen, there are two kinds of failure: the kind that stops your build, and the kind that does not. Here is why standard Rork and Rork Max differ, and the order I check generated code in.
◉ AI Models2026-08-07
Cutting MCP Tools Didn't Make Anything Lighter — 2,377 Bytes of Definitions vs 110,298 Bytes of Response
I wrote a minimal MCP server for a wallpaper catalog and measured the byte cost of tool definitions against the byte cost of responses. Here is which side actually matters, and the real reason to merge tools.
◉ AI Models2026-05-05
Build an AI Interview Coach App with Rork Max: Voice Recording, Claude Evaluation & Progress Tracking
How I built a production-ready AI interview coach app with Rork Max — expo-audio recording, Whisper transcription, Claude evaluation, a JSON extractor measured against six response shapes, and a free tier that is counted on the server.