Fix local dev config and ALOTTTT OFF FLUTTER, im tired boss..
This commit is contained in:
@@ -10,6 +10,7 @@ import '../../app/injection_container.dart';
|
||||
import '../../core/ai/detection_export.dart';
|
||||
import '../../core/constants/app_constants.dart';
|
||||
import '../../core/services/tts_service.dart';
|
||||
import '../../core/utils/operation_guard.dart';
|
||||
import '../../shared/widgets/feature_page.dart';
|
||||
|
||||
class AiBenchmarkScreen extends StatefulWidget {
|
||||
@@ -79,11 +80,11 @@ class _AiBenchmarkScreenState extends State<AiBenchmarkScreen> {
|
||||
notifWatch.stop();
|
||||
|
||||
final ttsWatch = Stopwatch()..start();
|
||||
try {
|
||||
await sl<TtsService>()
|
||||
await guarded<void>(
|
||||
() => sl<TtsService>()
|
||||
.speakImmediate(notificationText)
|
||||
.timeout(const Duration(seconds: 3));
|
||||
} catch (_) {}
|
||||
.timeout(const Duration(seconds: 3)),
|
||||
);
|
||||
ttsWatch.stop();
|
||||
|
||||
final run = {
|
||||
@@ -113,23 +114,27 @@ class _AiBenchmarkScreenState extends State<AiBenchmarkScreen> {
|
||||
Future<int> _measureCapture() async {
|
||||
final watch = Stopwatch()..start();
|
||||
CameraController? controller;
|
||||
try {
|
||||
await guarded<void>(
|
||||
() async {
|
||||
final cameras =
|
||||
await availableCameras().timeout(const Duration(seconds: 3));
|
||||
if (cameras.isNotEmpty) {
|
||||
controller = CameraController(
|
||||
final activeController = CameraController(
|
||||
cameras.first,
|
||||
ResolutionPreset.low,
|
||||
enableAudio: false,
|
||||
);
|
||||
await controller.initialize().timeout(const Duration(seconds: 5));
|
||||
await controller.takePicture().timeout(const Duration(seconds: 5));
|
||||
controller = activeController;
|
||||
await activeController.initialize().timeout(const Duration(seconds: 5));
|
||||
await activeController.takePicture().timeout(const Duration(seconds: 5));
|
||||
}
|
||||
} catch (_) {
|
||||
},
|
||||
onError: (_) {},
|
||||
);
|
||||
if (controller == null) {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 16));
|
||||
} finally {
|
||||
await controller?.dispose();
|
||||
}
|
||||
await controller?.dispose();
|
||||
watch.stop();
|
||||
return watch.elapsedMilliseconds;
|
||||
}
|
||||
@@ -273,7 +278,8 @@ class _StatusBox extends StatelessWidget {
|
||||
}
|
||||
|
||||
Future<List<String>> _discoverTfliteModels() async {
|
||||
try {
|
||||
return await guarded<List<String>>(
|
||||
() async {
|
||||
final manifestRaw = await rootBundle.loadString('AssetManifest.json');
|
||||
final manifest = jsonDecode(manifestRaw) as Map<String, dynamic>;
|
||||
final models = manifest.keys
|
||||
@@ -282,9 +288,9 @@ Future<List<String>> _discoverTfliteModels() async {
|
||||
.toList()
|
||||
..sort();
|
||||
return models;
|
||||
} catch (_) {
|
||||
return const [];
|
||||
}
|
||||
},
|
||||
) ??
|
||||
const [];
|
||||
}
|
||||
|
||||
String _two(int value) => value.toString().padLeft(2, '0');
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
export '../../ai_benchmark_screen.dart';
|
||||
Reference in New Issue
Block a user