Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated dependencies and fixed some errors on methods #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
example/
examples/
build/
mirland marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [0.4.1] - Moved to tflite flutter processor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use 0.4.0?

* Updated all libraries to support updated tflite_flutter package.
* fixed bug in android preventing build

# [0.3.0] - Audio Support and Task Library
* Added support for audio-cases.
* Task Library for Text based applications.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Sample app: [Audio Classification](https://github.com/am15h/tflite_flutter_helpe
// Create a container for the result and specify that this is a quantized model.
// Hence, the 'DataType' is defined as UINT8 (8-bit unsigned integer)
TensorBuffer probabilityBuffer =
TensorBuffer.createFixedSize(<int>[1, 1001], TfLiteType.uint8);
TensorBuffer.createFixedSize(<int>[1, 1001], TfLiteType.kTfLiteUInt8);
```

#### Loading the model and running inference:
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group 'com.tfliteflutter.tflite_flutter_helper'
group 'io.chaosdev.tflite_flutter_processing'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can change it

version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's too old, we may want to update it.

repositories {
google()
jcenter()
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
4 changes: 1 addition & 3 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
package android

rootProject.name = 'tflite_flutter_helper'
rootProject.name = 'tflite_flutter_processing'
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tfliteflutter.tflite_flutter_helper">
package="io.chaosdev.tflite_flutter_processing">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tfliteflutter.tflite_flutter_helper
package io.chaosdev.tflite_flutter_processing

import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
Expand Down Expand Up @@ -37,16 +37,16 @@ enum class SoundStreamStatus {
Stopped,
}

const val METHOD_CHANNEL_NAME = "com.tfliteflutter.tflite_flutter_helper:methods"
const val METHOD_CHANNEL_NAME = "io.chaosdev.tflite_flutter_processing:methods"

/** TfliteFlutterHelperPlugin */
class TfliteFlutterHelperPlugin : FlutterPlugin,
/** TfliteFlutterProcessingPlugin */
class TfliteFlutterProcessingPlugin : FlutterPlugin,
MethodCallHandler,
PluginRegistry.RequestPermissionsResultListener,
ActivityAware {


private val LOG_TAG = "TfLiteFlutterHelperPlugin"
private val LOG_TAG = "TfliteFlutterProcessingPlugin"
private val AUDIO_RECORD_PERMISSION_CODE = 14887
private val DEFAULT_SAMPLE_RATE = 16000
private val DEFAULT_BUFFER_SIZE = 8192
Expand Down Expand Up @@ -140,14 +140,14 @@ class TfliteFlutterHelperPlugin : FlutterPlugin,
}
}

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?,
grantResults: IntArray?): Boolean {
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>,
grantResults: IntArray): Boolean {
when (requestCode) {
AUDIO_RECORD_PERMISSION_CODE -> {
if (grantResults != null) {
permissionToRecordAudio = grantResults.isNotEmpty() &&
grantResults[0] == PackageManager.PERMISSION_GRANTED
}

permissionToRecordAudio = grantResults.isNotEmpty() &&
grantResults[0] == PackageManager.PERMISSION_GRANTED

completeInitializeRecorder()
return true
}
Expand Down
2 changes: 1 addition & 1 deletion example/audio_classification/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions example/audio_classification/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/audio_classification/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
4 changes: 2 additions & 2 deletions example/audio_classification/lib/classifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:audio_classification/main.dart';
import 'package:flutter/services.dart';
import 'package:collection/collection.dart';
import 'package:tflite_flutter/tflite_flutter.dart';
import 'package:tflite_flutter_helper/tflite_flutter_helper.dart';
import 'package:tflite_flutter_processing/tflite_flutter_processing.dart';

class Classifier {
late Interpreter interpreter;
Expand All @@ -15,7 +15,7 @@ class Classifier {

late TensorBuffer _outputBuffer;

TfLiteType _outputType = TfLiteType.uint8;
TensorType _outputType = TensorType.uint8;

final String _modelFileName = 'yamnet.tflite';
final String _labelFileName = 'assets/yamnet_class_map.csv';
Expand Down
4 changes: 2 additions & 2 deletions example/audio_classification/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:ui';
import 'package:audio_classification/classifier.dart';
import 'package:flutter/material.dart';
import 'package:random_color/random_color.dart';
import 'package:tflite_flutter_helper/tflite_flutter_helper.dart';
import 'package:tflite_flutter_processing/tflite_flutter_processing.dart';

void main() {
runApp(MyApp());
Expand Down Expand Up @@ -83,7 +83,7 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primaryColor: Colors.orange, accentColor: Colors.orange),
theme: ThemeData(primaryColor: Colors.orange, hintColor: Colors.orange),
home: Scaffold(
appBar: AppBar(
title: const Text(
Expand Down
Loading