How do I download Firebase ml custom model?

78 views Asked by At

I am developing an application with Flutter.
I uploaded a custom model to Firebase ml.
I want to download this cumstom model to local directory.
How do I download it?
This is my current code:

class ClassificationModel {
  final FirebaseModelDownloader downloader = FirebaseModelDownloader.instance;
  late final FirebaseCustomModel model;
  
  Future<void> initModel() async {
    model = await downloader
        .getModel(
      "ClassificationModel",
      FirebaseModelDownloadType.latestModel,
      FirebaseModelDownloadConditions(
        iosAllowsCellularAccess: true,
        iosAllowsBackgroundDownloading: false,
        androidChargingRequired: false,
        androidWifiRequired: false,
        androidDeviceIdleRequired: false,
      ),
    );
    final myModel = model.file;
    myModel.copy("assets/models/$myModel");
  }
}

It was uploaded properly to firebase ml and the model name also matches.
I confirmed that the file path is being read correctly.
An error occurs when copy file.
The error is "No such file or directory".

0

There are 0 answers