Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion AIDevGallery/Controls/ModelPicker/AddHFModelView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
Grid.Row="1"
HorizontalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="Browse and download generative language models from Hugging Face." />
Text="Browse and download generative language models from Hugging Face."
TextAlignment="Center"
TextWrapping="Wrap" />
<Grid
Grid.Row="2"
MaxWidth="560"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)

// Pick a file
var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
// Call function to run inference and classify image
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await EnhanceImage(file.Path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Visibility="Collapsed" />
<Grid
Margin="8"
Padding="2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{ThemeResource AcrylicBackgroundFillColorDefaultBrush}"
Expand All @@ -44,6 +45,7 @@
Padding="8"
AutomationProperties.Name="Select image"
Click="UploadButton_Click"
FocusVisualMargin="-3"
ToolTipService.ToolTip="Select image">

<FontIcon FontSize="16" Glyph="&#xEE71;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)
picker.ViewMode = PickerViewMode.Thumbnail;

var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await Segment(file.Path);
}
Expand All @@ -148,7 +148,7 @@ private async Task Segment(string filePath)
UploadButton.Visibility = Visibility.Collapsed;

DefaultImage.Source = new BitmapImage(new Uri(filePath));
NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: new upload."); // <exclude-line>
NarratorHelper.AnnounceImageChanged(DefaultImage, "Content changed: new upload."); // <exclude-line>

using Bitmap originalImage = new(filePath);
int originalImageWidth = originalImage.Width;
Expand Down Expand Up @@ -271,7 +271,7 @@ private async Task Segment(string filePath)
// Convert the final overlay to BitmapImage for display
BitmapImage outputImage = BitmapFunctions.ConvertBitmapToBitmapImage(processedImage);

NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: all regions segmented."); // <exclude-line>
NarratorHelper.AnnounceImageChanged(DefaultImage, "Content changed: all regions segmented."); // <exclude-line>

DispatcherQueue.TryEnqueue(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)
picker.ViewMode = PickerViewMode.Thumbnail;

var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await DetectObjects(file.Path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Visibility="Collapsed" />
<Grid
Margin="8"
Padding="2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{ThemeResource AcrylicBackgroundFillColorDefaultBrush}"
Expand All @@ -44,6 +45,7 @@
Padding="8"
AutomationProperties.Name="Select image"
Click="UploadButton_Click"
FocusVisualMargin="-3"
ToolTipService.ToolTip="Select image">

<FontIcon FontSize="16" Glyph="&#xEE71;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)
picker.ViewMode = PickerViewMode.Thumbnail;

var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await DetectPose(file.Path);
}
Expand All @@ -146,7 +146,7 @@ private async Task DetectPose(string filePath)
Loader.Visibility = Visibility.Visible;
UploadButton.Visibility = Visibility.Collapsed;
DefaultImage.Source = new BitmapImage(new Uri(filePath));
NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: new upload."); // <exclude-line>
NarratorHelper.AnnounceImageChanged(DefaultImage, "Content changed: new upload."); // <exclude-line>

using Bitmap originalImage = new(filePath);

Expand Down Expand Up @@ -182,7 +182,7 @@ private async Task DetectPose(string filePath)

using Bitmap output = PoseHelper.RenderPredictions(originalImage, predictions, .02f);
BitmapImage outputImage = BitmapFunctions.ConvertBitmapToBitmapImage(output);
NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: key points rendered."); // <exclude-line>
NarratorHelper.AnnounceImageChanged(DefaultImage, "Content changed: key points rendered."); // <exclude-line>

DispatcherQueue.TryEnqueue(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Visibility="Collapsed" />
<Grid
Margin="8"
Padding="2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{ThemeResource AcrylicBackgroundFillColorDefaultBrush}"
Expand All @@ -44,6 +45,7 @@
Padding="8"
AutomationProperties.Name="Select image"
Click="UploadButton_Click"
FocusVisualMargin="-3"
ToolTipService.ToolTip="Select image">

<FontIcon FontSize="16" Glyph="&#xEE71;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)
picker.ViewMode = PickerViewMode.Thumbnail;

var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
// Call function to run inference and classify image
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await RunPipeline(file.Path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ private async void UploadButton_Click(object sender, RoutedEventArgs e)

// Pick a file
var file = await picker.PickSingleFileAsync();
UploadButton.Focus(FocusState.Programmatic);
if (file != null)
{
// Call function to run inference and classify image
UploadButton.Focus(FocusState.Programmatic);
SendSampleInteractedEvent("FileSelected"); // <exclude-line>
await DetectObjects(file.Path);
}
Expand Down
Loading