Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Render model loading status

vishnukvmd529ad88a7067
diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart
index f0fc982cb2..3febd6407b 100644
--- a/lib/generated/intl/messages_en.dart
+++ b/lib/generated/intl/messages_en.dart
@@ -832,6 +832,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Loading gallery..."),
"loadingMessage":
MessageLookupByLibrary.simpleMessage("Loading your photos..."),
+ "loadingModel":
+ MessageLookupByLibrary.simpleMessage("Downloading models..."),
"localGallery": MessageLookupByLibrary.simpleMessage("Local gallery"),
"location": MessageLookupByLibrary.simpleMessage("Location"),
"locationName": MessageLookupByLibrary.simpleMessage("Location name"),
diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart
index 301641f619..9f3136f8a2 100644
--- a/lib/generated/l10n.dart
+++ b/lib/generated/l10n.dart
@@ -2876,6 +2876,16 @@ class S {
);
}
+ /// `Downloading models...`
+ String get loadingModel {
+ return Intl.message(
+ 'Downloading models...',
+ name: 'loadingModel',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `Status`
String get status {
return Intl.message(
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index 3718015175..20571d2e43 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -409,6 +409,7 @@
"machineLearning": "Machine learning",
"magicSearch": "Magic search",
"magicSearchDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
+ "loadingModel": "Downloading models...",
"status": "Status",
"indexedItems": "Indexed items",
"pendingItems": "Pending items",
@@ -704,7 +705,7 @@
"deleteAlbumsDialogBody": "This will delete all empty albums. This is useful when you want to reduce the clutter in your album list.",
"deleteProgress": "Deleting {currentlyDeleting} / {totalCount}",
"genericProgress": "Processing {currentlyProcessing} / {totalCount}",
- "@genericProgress" : {
+ "@genericProgress": {
"description": "Generic progress text to display when processing multiple items",
"type": "text",
"placeholders": {
@@ -718,7 +719,6 @@
}
}
},
-
"permanentlyDelete": "Permanently delete",
"canOnlyCreateLinkForFilesOwnedByYou": "Can only create link for files owned by you",
"publicLinkCreated": "Public link created",
@@ -1187,4 +1187,4 @@
"changeLocationOfSelectedItems": "Change location of selected items?",
"editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente",
"cleanUncategorized": "Clean Uncategorized"
-}
\ No newline at end of file
+}
diff --git a/lib/services/semantic_search/semantic_search_service.dart b/lib/services/semantic_search/semantic_search_service.dart
index 13cb66f9cd..06f56d94e0 100644
--- a/lib/services/semantic_search/semantic_search_service.dart
+++ b/lib/services/semantic_search/semantic_search_service.dart
@@ -38,7 +38,7 @@ class SemanticSearchService {
final _logger = Logger("SemanticSearchService");
final _queue = Queue<EnteFile>();
final _mlFramework = kCurrentModel == Model.onnxClip ? ONNX() : GGML();
- final _frameworkInitialization = Completer<void>();
+ final _frameworkInitialization = Completer<bool>();
final _embeddingLoaderDebouncer =
Debouncer(kDebounceDuration, executionInterval: kDebounceDuration);
@@ -141,6 +141,10 @@ class SemanticSearchService {
);
}
+ Future<bool> getFrameworkInitializationStatus() {
+ return _frameworkInitialization.future;
+ }
+
Future<void> clearIndexes() async {
await EmbeddingsDB.instance.deleteAllForModel(kCurrentModel);
_logger.info("Indexes cleared for $kCurrentModel");
@@ -232,7 +236,7 @@ class SemanticSearchService {
_logger.info("Initializing ML framework");
try {
await _mlFramework.init();
- _frameworkInitialization.complete();
+ _frameworkInitialization.complete(true);
} catch (e, s) {
_logger.severe("ML framework initialization failed", e, s);
}
diff --git a/lib/ui/settings/machine_learning_settings_page.dart b/lib/ui/settings/machine_learning_settings_page.dart
index de40c7947c..3bb38f8745 100644
--- a/lib/ui/settings/machine_learning_settings_page.dart
+++ b/lib/ui/settings/machine_learning_settings_page.dart
@@ -115,7 +115,17 @@ class _MachineLearningSettingsPageState
hasEnabled
? Column(
children: [
- const MagicSearchIndexStatsWidget(),
+ FutureBuilder(
+ future: SemanticSearchService.instance
+ .getFrameworkInitializationStatus(),
+ builder: (BuildContext context, AsyncSnapshot snapshot) {
+ if (snapshot.hasData) {
+ return const MagicSearchIndexStatsWidget();
+ } else {
+ return const ModelLoadingState();
+ }
+ },
+ ),
const SizedBox(
height: 12,
),
@@ -144,6 +154,31 @@ class _MachineLearningSettingsPageState
}
}
+class ModelLoadingState extends StatelessWidget {
+ const ModelLoadingState({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ MenuSectionTitle(title: S.of(context).status),
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: S.of(context).loadingModel,
+ ),
+ trailingWidget: EnteLoadingWidget(
+ size: 12,
+ color: getEnteColorScheme(context).fillMuted,
+ ),
+ singleBorderRadius: 8,
+ alignCaptionedTextToLeft: true,
+ isGestureDetectorDisabled: true,
+ ),
+ ],
+ );
+ }
+}
+
class MagicSearchIndexStatsWidget extends StatefulWidget {
const MagicSearchIndexStatsWidget({
super.key,