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,
})| Parameter | Type | Default | Description |
|---|---|---|---|
repoId | String | — | Hugging Face repository id, such as owner/repository. |
userAccessToken | String? | null | Optional Hugging Face access token for private repositories. |
manifestDir | String? | null | Optional manifest directory. Android uses this parameter; iOS accepts and ignores it. |
index | int | 0 | Model 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 isClosedReturns true after close releases the native model handle.
Methods
run
List<Tensor> run([List<Tensor> inputs = const []])Runs inference and returns output tensors.
| Parameter | Type | Description |
|---|---|---|
inputs | List<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.