Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tempo-riz committed Mar 15, 2024
1 parent 79ee7e7 commit d8b275c
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 39 deletions.
61 changes: 54 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,58 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

*.env
# Ignoring native folders of the example as they can be re-generated easily using:
# flutter create --platforms=android,ios,web,windows,macos .
**/example/android/
**/example/ios/
**/example/web/
examples/**/android/
examples/**/ios/
examples/**/web/
examples/**/windows/
examples/**/macos/
# Include specific entitlements files which enable internet access
!examples/**/macos/Runner/DebugProfile.entitlements

# Miscellaneous
coverage/
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
coverage.lcov

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
.vscode/settings.json

node_modules
package-lock.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Thibault Chatillon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,57 @@ and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
A simple Deepgram client for Dart and Flutter.

You can simply transcribe audio from : File, URL, Stream or Raw data.

Currently only supports Speech-To-Text (STT), maybe more in the future.
Feel free to contribute to this project or to ask for new features on [GitHub](https://github.com/tempo-riz/deepgram_speech_to_text) !


## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.
Speech to text transcription from:
- File
- URL
- Stream
- Raw data

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.
All you need is a Deepgram API key. You can get a free one by signing up on [Deepgram](https://www.deepgram.com/)

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
For a bit more detailed usage check `/example`

```dart
const like = 'sample';
String apiKey = 'your_api_key';
Deepgram deepgram = Deepgram(apiKey, baseQueryParams: params);
// -------------------- From a file --------------------
File audioFile = File('audio.wav');
String json1 = await deepgram.transcribeFromFile(audioFile);
// -------------------- From a URL --------------------
String json2 = await deepgram.transcribeFromUrl('https://somewhere/audio.wav');
// -------------------- From raw data --------------------
String json3 = await deepgram.transcribeFromBytes(List.from([1, 2, 3, 4, 5]));
// -------------------- From a stream --------------------
Stream<String> jsonStream = deepgram.transcribeFromLiveAudioStream(mic.stream);
// or to have more control over the stream
DeepgramLiveTranscriber transcriber = deepgram.createLiveTranscriber(mic.stream);
transcriber.start();
transcriber.jsonStream.listen(print);
transcriber.close();
```


## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
I created this package for my own needs since there are no dart sdk for deepgram. Happy to share !

Don't hesitate to ask for new features or to contribute !
5 changes: 2 additions & 3 deletions example/deepgram_example.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:io';
import 'package:deepgram_speech_to_text/deepgram.dart';
import 'package:deepgram_speech_to_text/deepgram_speech_to_text.dart';

void main() async {
// Get your API key from the Deepgram console if you don't have one https://console.deepgram.com/
Expand All @@ -11,7 +11,7 @@ void main() async {
// reference : https://developers.deepgram.com/reference/listen-file
Map<String, dynamic> params = {
'model': 'nova-2-general',
'language': 'latest',
'language': 'fr',
'filler_words': false,
'punctuation': true,
};
Expand Down Expand Up @@ -50,6 +50,5 @@ void main() async {
transcriber.jsonStream.listen((json) {
print(json);
});

transcriber.close();
}
10 changes: 0 additions & 10 deletions lib/deepgram.dart

This file was deleted.

1 change: 1 addition & 0 deletions lib/deepgram_speech_to_text.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'src/deepgram.dart';
9 changes: 3 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
name: deepgram_speech_to_text
description: A starting point for Dart libraries or applications.
description: A simple Deepgram client for Dart and Flutter.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
repository: https://github.com/tempo-riz/deepgram_speech_to_text

environment:
sdk: ^3.2.6

# Add regular dependencies here.
dependencies:
dotenv: ^4.2.0
http: ^1.2.0
web_socket_channel: ^2.4.0
# path: ^1.8.0

dev_dependencies:
lints: ^2.1.0
test: ^1.24.0
flutter_dotenv: ^5.1.0
dotenv: ^4.2.0

assets:
- .env
Expand Down
2 changes: 1 addition & 1 deletion test/deepgram_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:typed_data';

import 'package:deepgram_speech_to_text/deepgram.dart';
import 'package:deepgram_speech_to_text/deepgram_speech_to_text.dart';
import 'package:deepgram_speech_to_text/src/utils.dart';
import 'package:test/test.dart';
import 'package:dotenv/dotenv.dart';
Expand Down

0 comments on commit d8b275c

Please sign in to comment.