-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,027 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
<<<<<<< HEAD | ||
|
||
[submodule "native_lib/whisper.cpp"] | ||
path = native_lib/whisper.cpp | ||
======= | ||
[submodule "src/whisper.cpp"] | ||
path = src/whisper.cpp | ||
>>>>>>> e00b55753994ebd5a0ec17fcc2e129383927717a | ||
url = https://github.com/ggerganov/whisper.cpp.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled. | ||
|
||
version: | ||
revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
channel: stable | ||
|
||
project_type: plugin_ffi | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
- platform: android | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
- platform: ios | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
- platform: linux | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
- platform: macos | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
- platform: windows | ||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "example", | ||
"cwd": "example", | ||
"program": "lib/main.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "example (profile mode)", | ||
"cwd": "example", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "profile" | ||
}, | ||
{ | ||
"name": "example (release mode)", | ||
"cwd": "example", | ||
"program": "lib/main.dart", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "release" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.cxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// The Android Gradle Plugin builds the native code with the Android NDK. | ||
|
||
group 'com.example.whisper_dart' | ||
version '1.0' | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
// The Android Gradle Plugin knows how to build native code with the NDK. | ||
classpath 'com.android.tools.build:gradle:7.1.2' | ||
} | ||
} | ||
|
||
rootProject.allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
// Bumping the plugin compileSdkVersion requires all clients of this plugin | ||
// to bump the version in their app. | ||
compileSdkVersion 31 | ||
|
||
// Bumping the plugin ndkVersion requires all clients of this plugin to bump | ||
// the version in their app and to download a newer version of the NDK. | ||
ndkVersion "25.1.8937393" | ||
|
||
// Invoke the shared CMake build with the Android Gradle Plugin. | ||
externalNativeBuild { | ||
cmake { | ||
path "../src/CMakeLists.txt" | ||
|
||
// The default CMake version for the Android Gradle Plugin is 3.10.2. | ||
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake | ||
// | ||
// The Flutter tooling requires that developers have CMake 3.10 or later | ||
// installed. You should not increase this version, as doing so will cause | ||
// the plugin to fail to compile for some customers of the plugin. | ||
// version "3.10.2" | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
defaultConfig { | ||
minSdkVersion 16 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'whisper_dart' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.whisper_dart"> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ignore_for_file: non_constant_identifier_names, avoid_print | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:whisper_dart/whisper_dart.dart'; | ||
|
||
void main(List<String> arguments) { | ||
Directory current = Directory.current; | ||
DateTime time = DateTime.now(); | ||
|
||
Whisper whisper = Whisper(); | ||
try { | ||
var res = whisper.request( | ||
request: WhisperRequest.fromWavFile( | ||
audio: File("${current.path}/samples/your_sample.wav"), | ||
// check it here: https://github.com/ggerganov/whisper.cpp/tree/master/models | ||
model: File("${current.path}/models/your_model.bin"), | ||
), | ||
); | ||
print(res.text); | ||
print(time.millisecondsSinceEpoch); | ||
} catch (e) { | ||
print(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# whisper_dart_example | ||
|
||
Demonstrates how to use the whisper_dart plugin. | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter application. | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) | ||
|
||
For help getting started with Flutter development, view the | ||
[online documentation](https://docs.flutter.dev/), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// This is a basic Flutter widget test. | ||
// | ||
// To perform an interaction with a widget in your test, use the WidgetTester | ||
// utility in the flutter_test package. For example, you can send tap and scroll | ||
// gestures. You can also use WidgetTester to find child widgets in the widget | ||
// tree, read text, and verify that the values of widget properties are correct. | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import 'package:whisper_dart_example/main.dart'; | ||
|
||
void main() { | ||
testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
// Build our app and trigger a frame. | ||
await tester.pumpWidget(const MyApp()); | ||
|
||
// Verify that our counter starts at 0. | ||
expect(find.text('0'), findsOneWidget); | ||
expect(find.text('1'), findsNothing); | ||
|
||
// Tap the '+' icon and trigger a frame. | ||
await tester.tap(find.byIcon(Icons.add)); | ||
await tester.pump(); | ||
|
||
// Verify that our counter has incremented. | ||
expect(find.text('0'), findsNothing); | ||
expect(find.text('1'), findsOneWidget); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Relative import to be able to reuse the C sources. | ||
// See the comment in ../{projectName}}.podspec for more information. | ||
#include "../../src/whisper_dart.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. | ||
# Run `pod lib lint whisper_dart.podspec` to validate before publishing. | ||
# | ||
Pod::Spec.new do |s| | ||
s.name = 'whisper_dart' | ||
s.version = '0.0.1' | ||
s.summary = 'A new Flutter FFI plugin project.' | ||
s.description = <<-DESC | ||
A new Flutter FFI plugin project. | ||
DESC | ||
s.homepage = 'http://example.com' | ||
s.license = { :file => '../LICENSE' } | ||
s.author = { 'Your Company' => '[email protected]' } | ||
|
||
# This will ensure the source files in Classes/ are included in the native | ||
# builds of apps using this FFI plugin. Podspec does not support relative | ||
# paths, so Classes contains a forwarder C file that relatively imports | ||
# `../src/*` so that the C sources can be shared among all target platforms. | ||
s.source = { :path => '.' } | ||
s.source_files = 'Classes/**/*' | ||
s.dependency 'Flutter' | ||
s.platform = :ios, '9.0' | ||
|
||
# Flutter.framework does not contain a i386 slice. | ||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } | ||
s.swift_version = '5.0' | ||
end |
Oops, something went wrong.