sherpa_onnx 0.0.3 copy "sherpa_onnx: ^0.0.3" to clipboard
sherpa_onnx: ^0.0.3 copied to clipboard

Speech recognition, speech synthesis, and speaker recognition using next-gen Kaldi with onnxruntime without Internet connection.

example/lib/main.dart

// Copyright (c)  2024  Xiaomi Corporation
import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx;
import 'package:flutter/material.dart';

import './vad.dart';
import './streaming_asr.dart';
import './info.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Next-gen Kaldi',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Next-gen Kaldi Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _currentIndex = 0;
  final List<Widget> _tabs = [
    StreamingAsrScreen(),
    VadScreen(),
    InfoScreen(),
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: _tabs[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (int index) {
          setState(() {
            _currentIndex = index;
          });
        },
        // https://www.xiconeditor.com/
        items: [
          BottomNavigationBarItem(
            icon: new Image.asset("assets/streaming-asr.ico"),
            label: '',
          ),
          BottomNavigationBarItem(
            icon: new Image.asset("assets/vad.ico"),
            label: '',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.info),
            label: 'Info',
          ),
        ],
      ),
    );
  }
}
26
likes
140
pub points
85%
popularity

Publisher

unverified uploader

Speech recognition, speech synthesis, and speaker recognition using next-gen Kaldi with onnxruntime without Internet connection.

Homepage
Repository (GitHub)
View/report issues

Topics

#speech-recognition #speech-synthesis #speaker-identification #audio-tagging #voice-activity-detection

Documentation

Documentation
API reference

License

Apache-2.0 (license)

Dependencies

ffi, flutter

More

Packages that depend on sherpa_onnx