-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from openvinotoolkit/arendjan/tti_draft
TTI feature
- Loading branch information
Showing
28 changed files
with
1,526 additions
and
97 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:inference/inference/text/metric_widgets.dart'; | ||
import 'package:inference/interop/openvino_bindings.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class TTICirclePropRow extends StatelessWidget { | ||
final TTIMetrics metrics; | ||
|
||
const TTICirclePropRow({super.key, required this.metrics}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Locale locale = Localizations.localeOf(context); | ||
final nf = NumberFormat.decimalPatternDigits( | ||
locale: locale.languageCode, decimalDigits: 0); | ||
|
||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
CircleProp( | ||
header: "Time to load model", | ||
value: nf.format(metrics.load_time), | ||
unit: "ms", | ||
), | ||
CircleProp( | ||
header: "Time to generate image", | ||
value: nf.format(metrics.generate_time), | ||
unit: "ms", | ||
) | ||
], | ||
); | ||
} | ||
} |
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,71 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:inference/inference/text/metric_widgets.dart'; | ||
import 'package:inference/inference/textToImage/tti_metric_widgets.dart'; | ||
import 'package:inference/providers/text_to_image_inference_provider.dart'; | ||
import 'package:inference/theme.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class TTIPerformanceMetricsPage extends StatefulWidget { | ||
const TTIPerformanceMetricsPage({super.key}); | ||
|
||
@override | ||
State<TTIPerformanceMetricsPage> createState() => _TTIPerformanceMetricsPageState(); | ||
} | ||
|
||
class _TTIPerformanceMetricsPageState extends State<TTIPerformanceMetricsPage> { | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
final provider = Provider.of<TextToImageInferenceProvider>(context, listen: false); | ||
if (provider.metrics == null) { | ||
provider.loaded.future.then((_) { | ||
provider.message("Generate OpenVINO logo"); | ||
}); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Consumer<TextToImageInferenceProvider>(builder: (context, inference, child) { | ||
if (inference.metrics == null) { | ||
return Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Image.asset('images/intel-loading.gif', width: 100), | ||
const Text("Running benchmark prompt...") | ||
], | ||
) | ||
); | ||
} | ||
|
||
Locale locale = Localizations.localeOf(context); | ||
final nf = NumberFormat.decimalPatternDigits( | ||
locale: locale.languageCode, decimalDigits: 0); | ||
|
||
final metrics = inference.metrics!; | ||
|
||
return Container( | ||
decoration: BoxDecoration( | ||
shape: BoxShape.rectangle, | ||
borderRadius: const BorderRadius.all(Radius.circular(8)), | ||
color: intelGray, | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.all(30.0), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
TTICirclePropRow(metrics: metrics), | ||
], | ||
), | ||
), | ||
); | ||
}); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.