Melange
API ReferenceFlutter

ZeticMLangeHFModel

Complete API reference for the ZeticMLangeHFModel class in Flutter.

This page reflects zetic_mlange 1.8.1.

ZeticMLangeHFModel loads supported Hugging Face-hosted ZTC models through the native Android and iOS SDKs.

Import

import 'package:zetic_mlange/zetic_mlange.dart';

Constructors

create

static Future<ZeticMLangeHFModel> create(
  String repoId, {
  String? userAccessToken,
  String? manifestDir,
  int index = 0,
})
ParameterTypeDefaultDescription
repoIdStringHugging Face repository id, such as owner/repository.
userAccessTokenString?nullOptional Hugging Face access token for private repositories.
manifestDirString?nullOptional manifest directory. Android uses this parameter; iOS accepts and ignores it.
indexint0Model index when the repository contains multiple ZTC models.
final model = await ZeticMLangeHFModel.create(
  'owner/repository',
  userAccessToken: hfToken,
  manifestDir: 'ztc',
);

Throws: MlangeException or a native SDK error if the repository, manifest, selected model index, or native runtime cannot be loaded.


Properties

isClosed

bool get isClosed

Returns true after close releases the native model handle.


Methods

run

List<Tensor> run([List<Tensor> inputs = const []])

Runs inference and returns output tensors.

ParameterTypeDescription
inputsList<Tensor>Input tensors matching the selected Hugging Face model's expected shapes and data types.
final outputs = model.run(inputs);

Throws: MlangeException if the input tensor count or byte length does not match the native model input buffers, or a native SDK error if inference fails.

close

void close()

Releases the native model handle.

After close(), calling run() or close() again throws MlangeException because the native handle has been released.

On this page