Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
5689a9bd
Commit
5689a9bd
authored
Oct 21, 2020
by
Dasun Madushanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update main.dart
parent
8fe5de91
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
MainAppDMT/lib/main.dart
MainAppDMT/lib/main.dart
+10
-2
No files found.
MainAppDMT/lib/main.dart
View file @
5689a9bd
//import main packeges
//image picker package for take a picture from gallery and tflite package to detect the image and read the assest file
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:tflite/tflite.dart'
;
//to run hotstart
void
main
(
)
=>
runApp
(
MaterialApp
(
home:
MyApp
(),
));
...
...
@@ -13,6 +17,7 @@ class MyApp extends StatefulWidget {
}
class
_MyAppState
extends
State
<
MyApp
>
{
//variables
List
_outputs
;
File
_image
;
bool
_loading
=
false
;
...
...
@@ -70,6 +75,8 @@ class _MyAppState extends State<MyApp> {
);
}
//function for image picker
pickImage
()
async
{
var
image
=
await
ImagePicker
.
pickImage
(
source
:
ImageSource
.
gallery
);
if
(
image
==
null
)
return
null
;
...
...
@@ -80,6 +87,7 @@ class _MyAppState extends State<MyApp> {
classifyImage
(
image
);
}
//detect the image and compare the image with the model
classifyImage
(
File
image
)
async
{
var
output
=
await
Tflite
.
runModelOnImage
(
path:
image
.
path
,
...
...
@@ -93,14 +101,14 @@ class _MyAppState extends State<MyApp> {
_outputs
=
output
;
});
}
//load the model from assest folder.
loadModel
()
async
{
await
Tflite
.
loadModel
(
model:
"assets/model_unquant.tflite"
,
labels:
"assets/labels.txt"
,
);
}
//dispose the model menu
@override
void
dispose
()
{
Tflite
.
close
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment