refactoring to a widget dir
This commit is contained in:
@@ -1,16 +1,8 @@
|
|||||||
# tensordex_mobile
|
# tensordex_mobile
|
||||||
|
|
||||||
Pokedex made using Tensorflow 2.0
|
Pokedex made using Tensorflow 2.9 and flutter 3.0.
|
||||||
|
|
||||||
## Getting Started
|
Build instructions:
|
||||||
|
* coming when I have time
|
||||||
This project is a starting point for a Flutter application.
|
* for now just install_tflite.script and then flutter build this thing
|
||||||
|
*
|
||||||
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.
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tensordex_mobile/ui/tensordex_home.dart';
|
import 'package:tensordex_mobile/widgets/tensordex_home.dart';
|
||||||
import 'package:tensordex_mobile/utils/logger.dart';
|
import 'package:tensordex_mobile/utils/logger.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import '../utils/logger.dart';
|
|||||||
import '../tflite/data/recognition.dart';
|
import '../tflite/data/recognition.dart';
|
||||||
import '../tflite/data/stats.dart';
|
import '../tflite/data/stats.dart';
|
||||||
|
|
||||||
/// [PokedexView] sends each frame for inference
|
/// [PokeFinder] sends each frame for inference
|
||||||
class PokedexView extends StatefulWidget {
|
class PokeFinder extends StatefulWidget {
|
||||||
/// Callback to pass results after inference to [HomeView]
|
/// Callback to pass results after inference to [HomeView]
|
||||||
final Function(List<Recognition> recognitions) resultsCallback;
|
final Function(List<Recognition> recognitions) resultsCallback;
|
||||||
|
|
||||||
@@ -19,15 +19,15 @@ class PokedexView extends StatefulWidget {
|
|||||||
final Function(Stats stats) statsCallback;
|
final Function(Stats stats) statsCallback;
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
const PokedexView(
|
const PokeFinder(
|
||||||
{Key? key, required this.resultsCallback, required this.statsCallback})
|
{Key? key, required this.resultsCallback, required this.statsCallback})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PokedexView> createState() => _PokedexViewState();
|
State<PokeFinder> createState() => _PokeFinderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PokedexViewState extends State<PokedexView> with WidgetsBindingObserver {
|
class _PokeFinderState extends State<PokeFinder> with WidgetsBindingObserver {
|
||||||
late List<CameraDescription> cameras;
|
late List<CameraDescription> cameras;
|
||||||
late CameraController cameraController;
|
late CameraController cameraController;
|
||||||
late MLIsolate _mlIsolate;
|
late MLIsolate _mlIsolate;
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tensordex_mobile/ui/poke_view.dart';
|
import 'package:tensordex_mobile/widgets/poke_finder.dart';
|
||||||
import 'package:tensordex_mobile/tflite/data/recognition.dart';
|
import 'package:tensordex_mobile/tflite/data/recognition.dart';
|
||||||
import 'package:tensordex_mobile/tflite/data/stats.dart';
|
import 'package:tensordex_mobile/tflite/data/stats.dart';
|
||||||
|
|
||||||
|
|
||||||
/// [PokedexView] sends each frame for inference
|
/// [PokeFinder] sends each frame for inference
|
||||||
class ResultsView extends StatefulWidget {
|
class Results extends StatefulWidget {
|
||||||
final List<Recognition> recognitions;
|
final List<Recognition> recognitions;
|
||||||
final Stats stats;
|
final Stats stats;
|
||||||
/// Constructor
|
/// Constructor
|
||||||
const ResultsView(this.recognitions, this.stats, {Key? key}) : super(key: key);
|
const Results(this.recognitions, this.stats, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ResultsView> createState() => _ResultsViewState();
|
State<Results> createState() => _ResultsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ResultsViewState extends State<ResultsView> {
|
class _ResultsState extends State<Results> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tensordex_mobile/ui/poke_view.dart';
|
import 'package:tensordex_mobile/widgets/poke_finder.dart';
|
||||||
import 'package:tensordex_mobile/ui/results_view.dart';
|
import 'package:tensordex_mobile/widgets/results.dart';
|
||||||
|
|
||||||
import '../utils/logger.dart';
|
import '../utils/logger.dart';
|
||||||
import '../tflite/data/recognition.dart';
|
import '../tflite/data/recognition.dart';
|
||||||
@@ -44,14 +44,14 @@ class _TensordexHomeState extends State<TensordexHome> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callback to get inference results from [PokedexView]
|
/// Callback to get inference results from [PokeFinder]
|
||||||
void resultsCallback(List<Recognition> results) {
|
void resultsCallback(List<Recognition> results) {
|
||||||
setState(() {
|
setState(() {
|
||||||
this.results = results;
|
this.results = results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callback to get inference stats from [PokedexView]
|
/// Callback to get inference stats from [PokeFinder]
|
||||||
void statsCallback(Stats stats) {
|
void statsCallback(Stats stats) {
|
||||||
setState(() {
|
setState(() {
|
||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
@@ -68,10 +68,10 @@ class _TensordexHomeState extends State<TensordexHome> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
PokedexView(
|
PokeFinder(
|
||||||
resultsCallback: resultsCallback,
|
resultsCallback: resultsCallback,
|
||||||
statsCallback: statsCallback),
|
statsCallback: statsCallback),
|
||||||
ResultsView(results, stats),
|
Results(results, stats),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Reference in New Issue
Block a user