qlaya_flutter 0.5.0
qlaya_flutter: ^0.5.0 copied to clipboard
QLaya Flutter & Dart client for the fast on-device decision engine powered by the qlaya.int8.onnx model for classification, scoring, verification, and routing tasks.
qlaya_flutter #
QLaya Flutter — Fast, local, on-device decision engine client for Flutter and Dart, powered by the qlaya.int8.onnx quantized model hosted on Hugging Face Hub.
Hugging Face Model | GitHub Repository | pub.dev Package | Issues & Feedback
Model Specifications #
The official quantized model weights are hosted on Hugging Face Hub at saipy10/qlaya:
- Model File:
qlaya.int8.onnx(~571.9 MB) - Quantization: ONNX INT8 per-channel
- Latency (p50): ~134.7 ms
- RAM Working Set: ~590 MB
- Direct Download URL:
https://huggingface.co/saipy10/qlaya/resolve/main/qlaya.int8.onnx - Capabilities: Fast on-device classification, continuous scoring, boolean verification, and workflow routing.
Installation #
Add to your Flutter or Dart project:
flutter pub add qlaya_flutter
# or for Dart CLI / server apps:
dart pub add qlaya_flutter
Downloading the Model #
You can obtain the model weights either via a command or directly within your code:
1. Download via CLI Command #
Run the built-in downloader to fetch qlaya.int8.onnx from Hugging Face into your current directory or custom path:
# Download into current directory
dart run qlaya_flutter:download
# Or specify a custom target directory
dart run qlaya_flutter:download --dir=./models
# Force re-download
dart run qlaya_flutter:download --force
2. Download / Ensure Programmatically in Dart / Flutter #
You can also ensure the model exists or download it on-the-fly directly inside your app:
import 'package:qlaya_flutter/qlaya_flutter.dart';
void main() async {
// Check if model is already downloaded
if (!QLayaDownloader.isModelAvailable()) {
print('Downloading model weights from Hugging Face...');
await QLayaDownloader.download(
onProgress: (p) {
print('${p.percent}% (${p.receivedMb} / ${p.totalMb} MB)');
},
);
}
}
Inference Usage #
Use QLayaClient to run type-safe decision tasks:
import 'package:qlaya_flutter/qlaya_flutter.dart';
void main() async {
// Connects to local server (defaults to http://localhost:8000)
final client = QLayaClient();
// Task 1: Intent Classification
final intent = await client.classify(
text: 'I was charged twice, please refund',
choices: ['refund_request', 'subscription_cancel', 'tech_support'],
);
print('Classified Choice: ${intent.choice}');
// Task 2: Continuous Scoring / Rating
final urgency = await client.score(
text: 'CRITICAL: Database connection timeout in production!',
instruction: 'Rate urgency from 0.0 (low) to 1.0 (emergency)',
);
print('Urgency Score: ${urgency.score}');
// Task 3: Boolean Verification
final isComplaint = await client.verify(
text: 'Product stopped working after 2 days.',
statement: 'Customer is filing a complaint',
);
print('Is Complaint: ${isComplaint.value}');
// Task 4: Workflow Routing
final routing = await client.route(
text: 'Need to add 15 enterprise seats for next quarter',
routes: ['sales_enterprise', 'tier1_support', 'billing_ops'],
);
print('Route To: ${routing.route}');
client.close();
}
Running the Inference Server #
Start the local QLaya engine server using the downloaded ONNX model:
pip install qlaya[serve]
qlaya-serve --model qlaya.int8.onnx --port 8000
License #
Apache-2.0 — see LICENSE.