Skip to content

Commit

Permalink
Update packages/mediapipe-task-text/example/lib/text_embedding_demo.dart
Browse files Browse the repository at this point in the history
Co-authored-by: Kate Lovett <katelovett@google.com>
  • Loading branch information
craiglabenz and Piinks authored Mar 18, 2024
1 parent e7a2f2f commit ad486a2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/mediapipe-task-text/example/lib/text_embedding_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,9 @@ class TextEmbedderResultDisplay extends StatelessWidget {
return const CircularProgressIndicator.adaptive();
}
final embedding = embeddedText.result!.embeddings.last;
late String embeddingDisplay;
switch (embedding.type) {
case EmbeddingType.float:
{
embeddingDisplay = '${embedding.floatEmbedding!}';
}
case EmbeddingType.quantized:
{
embeddingDisplay = '${embedding.quantizedEmbedding!}';
}
String embeddingDisplay = switch (embedding.type) {
EmbeddingType.float => '${embedding.floatEmbedding!}',
EmbeddingType.quantized =>'${embedding.quantizedEmbedding!}',
}
// Replace "..." with the results
final message = '"${embeddedText.value}"\n$embeddingDisplay';
Expand Down

0 comments on commit ad486a2

Please sign in to comment.