Giter Site home page Giter Site logo

bljubisic / whisper_dart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azkadev/whisper

0.0 0.0 0.0 40.79 MB

speech recognition in dart support all audio format and support server side client side, + support all language, only support in cpu only

License: MIT License

C++ 95.84% C 0.15% Objective-C 0.01% Kotlin 0.01% Dart 1.68% Swift 0.12% Makefile 0.10% HTML 0.19% CMake 1.91%

whisper_dart's Introduction

Whisper

Whisper library speech to text offline,

Refrence

  1. Whisper-Official
  2. Whisper.cpp

this library is not in maintenance, just for example, if you want to transcribe audio to text please use galaxeus_ai

Screenshot

Screenshot from 2022-10-24 17-28-26

Install

dart pub add whisper_dart

Compile library

  1. for linux
git clone --recursive https://github.com/azkadev/whisper_dart.git
cd whisper_dart
cd native_lib
make
sudo make install
  1. for android
git clone --recursive https://github.com/azkadev/whisper_dart.git
cd whisper_dart
cd native_lib
make
make compile.android

Tested on

I only have this device, so sorry I can't test other devices

  1. OS: Ubuntu 20.4 CPU: Amd Ryzen 5500u Ram: 8gb
  2. Os: Android 11 CPU: Snapdragon 665 Ram: 3gb

example

example dengan auto convert dari semua jenis audio ke wav whisper, ffmpeg harus terinstall

// ignore_for_file: non_constant_identifier_names
import 'package:galaxeus_lib/galaxeus_lib.dart';
import 'package:universal_io/io.dart';
import 'package:whisper_dart/whisper_dart.dart';
import 'package:ffmpeg_dart/ffmpeg_dart.dart';

void main(List<String> arguments) {
  DateTime time = DateTime.now(); 
  // print(res);
  Whisper whisper = Whisper(
    whisperLib: "whisper.cpp/whisper.so",
  );
  try {
    var res = whisper.request(
      whisperRequest: WhisperRequest.fromWavFile(
        /// auto convert to wav 16 
        audio: WhisperAudioconvert.convert(
          audioInput: File("samples/audio.ogg"),
          audioOutput: File("samples/output.wav"),
        ),
        model: File("models/ggml-model-whisper-small.bin"),
      ),
    );
    print(res.toString());
    print(convertToAgo(time.millisecondsSinceEpoch));
  } catch (e) {
    print(e);
  }
}

result

{
  "@type":"transcribe",
  "text":" Baby, aku pergi dulu ya, babai sayang. *muach*"
}

example 2

example convert audio to text without auto convert

// ignore_for_file: non_constant_identifier_names
import 'package:galaxeus_lib/galaxeus_lib.dart';
import 'package:universal_io/io.dart';
import 'package:whisper_dart/whisper_dart.dart';
import 'package:ffmpeg_dart/ffmpeg_dart.dart';

void main(List<String> arguments) {
  DateTime time = DateTime.now(); 
  // print(res);
  Whisper whisper = Whisper(
    whisperLib: "whisper.cpp/whisper.so",
  );
  try {
    var res = whisper.request(
      whisperRequest: WhisperRequest.fromWavFile(
        audio: File("samples/output.wav"),
        model: File("models/ggml-model-whisper-small.bin"),
      ),
    );
    print(res.toString());
    print(convertToAgo(time.millisecondsSinceEpoch));
  } catch (e) {
    print(e);
  }
}

result

{
  "@type":"transcribe",
  "text":" And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country."
}

Language Support

whisper_dart's People

Contributors

azkadev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.