Skip to content

Commit f9affa0

Browse files
author
Sheil Kumar
committed
update encrypted models sample
1 parent 1ecded3 commit f9affa0

File tree

7 files changed

+129
-511
lines changed

7 files changed

+129
-511
lines changed

Samples/WinMLSamplesGallery/WinMLSamplesGallery (Package)/WinMLSamplesGallery (Package).wapproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@
128128
</ProjectReference>
129129
</ItemGroup>
130130
<ItemGroup>
131-
<None Include="$(SolutionDir)$(Platform)\$(Configuration)\WinMLSamplesGalleryNative\*.dll" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
132131
<None Include="$(SolutionDir)..\..\build\external\opencv\cmake_config\$(Platform)\bin\$(Configuration)\*.dll" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
133132
</ItemGroup>
134133
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
135134
<ItemGroup>
136-
<PackageReference Include="Microsoft.AI.MachineLearning" Version="1.9.1" />
137-
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.4">
135+
<PackageReference Include="Microsoft.AI.MachineLearning">
136+
<Version>1.9.1</Version>
137+
</PackageReference>
138+
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.5">
138139
<IncludeAssets>build</IncludeAssets>
139140
</PackageReference>
140141
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.0]">

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/EncryptedResource/EncryptedResource.xaml

Lines changed: 29 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -10,164 +10,35 @@
1010

1111
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1212

13-
<Page.Resources>
14-
<DataTemplate x:Key="ImageTemplate" x:DataType="local_controls:Thumbnail">
15-
<Image Stretch="UniformToFill" Source="{x:Bind ImageUri}" Width="200" Height="204" />
16-
</DataTemplate>
17-
18-
<DataTemplate x:Name="InferenceResultsTemplate" x:DataType="local_controls:Prediction">
19-
<StackPanel Orientation="Horizontal">
20-
<TextBlock Width="414"
21-
FontSize="14"
22-
Foreground="Black"
23-
Padding="0,1,1,1"
24-
Typography.Capitals="AllSmallCaps"
25-
Typography.StylisticSet4="True"
26-
TextTrimming="CharacterEllipsis">
27-
<Run Text="[" />
28-
<Run Text="{Binding Index}" />
29-
<Run Text="] " />
30-
<Run Text="{Binding Name}" />
31-
</TextBlock>
32-
<TextBlock Width="120"
33-
FontSize="14"
34-
Foreground="Black"
35-
Padding="0,1,1,1"
36-
Typography.Capitals="AllSmallCaps"
37-
Typography.StylisticSet4="True">
38-
<Run Text="p =" />
39-
<Run Text="{Binding Probability}" />
40-
</TextBlock>
41-
</StackPanel>
42-
</DataTemplate>
43-
44-
<DataTemplate x:Name="AllModelsTemplate" x:DataType="local_samples:ClassifierViewModel">
45-
<Grid Background="#e6e6e6" BorderBrush="#12bef6" BorderThickness="1">
46-
<TextBlock FontSize="14" Text="{x:Bind Title}"
47-
Typography.Capitals="AllSmallCaps"
48-
Typography.StylisticSet4="True"
49-
VerticalAlignment="Top"
50-
Padding="10,2,10,2"
51-
MinWidth="136"
52-
/>
53-
</Grid>
54-
</DataTemplate>
55-
</Page.Resources>
56-
57-
<Grid>
58-
<ScrollViewer
59-
ZoomMode="Disabled"
60-
IsVerticalScrollChainingEnabled="True"
61-
HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Disabled"
62-
VerticalScrollMode="Enabled" VerticalScrollBarVisibility="Visible">
63-
<Grid>
64-
<Grid.RowDefinitions>
65-
<RowDefinition Height="*" />
66-
<RowDefinition Height="Auto" />
67-
<RowDefinition Height="*" />
68-
</Grid.RowDefinitions>
69-
70-
<StackPanel Grid.Row="0" Orientation="Horizontal" Padding="0,10,0,0">
71-
<StackPanel Orientation="Vertical">
72-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
73-
<Button FontFamily="Segoe MDL2 Assets" Content="&#xE1A5;" Width="55" Height="50" HorizontalAlignment="Left" Click="OpenButton_Clicked" />
74-
<Grid Padding="5,0,0,0">
75-
<ComboBox x:Name="DeviceComboBox" SelectedIndex="0" Background="LightGray" PlaceholderText="Device" Height="50" Width="139"
76-
SelectionChanged="DeviceComboBox_SelectionChanged">
77-
<TextBlock Text="CPU" FontSize="18" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"/>
78-
<TextBlock Text="DirectML" FontSize="18" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"/>
79-
</ComboBox>
80-
</Grid>
81-
</StackPanel>
82-
<GridView
83-
x:Name="BasicGridView"
84-
ItemTemplate="{StaticResource ImageTemplate}"
85-
IsItemClickEnabled="True"
86-
SelectionChanged="SampleInputsGridView_SelectionChanged"
87-
SelectionMode="Single"
88-
Padding="0,6,0,0"
89-
HorizontalAlignment="Center">
90-
<GridView.ItemsPanel>
91-
<ItemsPanelTemplate>
92-
<StackPanel Orientation="Vertical" />
93-
</ItemsPanelTemplate>
94-
</GridView.ItemsPanel>
95-
<GridView.Items>
96-
<local_controls:Thumbnail ImageUri="ms-appx:///InputData/hummingbird.jpg" />
97-
</GridView.Items>
98-
</GridView>
99-
</StackPanel>
100-
101-
<StackPanel Orientation="Horizontal">
102-
<StackPanel Orientation="Vertical" Margin="11,0,0,0">
103-
<Border x:Name="OriginalBorder" Background="LightGray" BorderBrush="LightGray" CornerRadius="5,5,0,0" Padding="0,5,0,5">
104-
<Grid Width="200">
105-
<TextBlock Text="Original" FontSize="18" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True" HorizontalAlignment="Center"/>
106-
</Grid>
107-
</Border>
108-
<Grid Background="LightGray" HorizontalAlignment="Center" Height="200" Width="200" VerticalAlignment="Top">
109-
<Image x:Name="InputImage" Stretch="UniformToFill" Height="200" HorizontalAlignment="Center"/>
110-
</Grid>
111-
<Button Content="Classify" x:Name="InferOriginal" IsEnabled="false" FontFamily="Segoe UI Light" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"
112-
Style="{StaticResource AccentButtonStyle}" Width="200"
113-
Click="InferOriginal_Click"/>
13+
<Grid>
14+
<StackPanel Orientation="Horizontal" Margin="0,20,0,0">
15+
<PasswordBox x:Name="DecryptionKey" Header="Enter the key:" Width="200" PlaceholderText="DecryptionKey" PasswordChar="#"/>
16+
<Button Content="Decrypt" x:Name="DecryptButton"
17+
Margin="2,0,0,0" Click="OnDecryptClick" VerticalAlignment="Bottom"
18+
Style="{StaticResource AccentButtonStyle}"
19+
Width="100" />
20+
<Button Content="View key..." Margin="5,0,0,0" VerticalAlignment="Bottom">
21+
<Button.Flyout>
22+
<Flyout>
23+
<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right">
24+
<TextBlock FontFamily="Segoe UI Light" FontSize="12" Margin="0,0,0,5">WindowsMLSamples</TextBlock>
11425
</StackPanel>
115-
116-
<StackPanel Orientation="Vertical" Margin="11,0,0,0">
117-
<Border x:Name="NoisyBorder" Background="LightGray" BorderBrush="LightGray" CornerRadius="5,5,0,0" Padding="0,5,0,5">
118-
<Grid Width="200">
119-
<TextBlock Text="Noisy" FontSize="18" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True" HorizontalAlignment="Center"/>
120-
</Grid>
121-
</Border>
122-
<Grid Background="LightGray" HorizontalAlignment="Center" Height="200" Width="200" VerticalAlignment="Top">
123-
<Image x:Name="NoisyImage" Stretch="UniformToFill" Height="200" HorizontalAlignment="Center"/>
124-
</Grid>
125-
<Button Content="Classify" x:Name="InferNoisy" IsEnabled="false" FontFamily="Segoe UI Light" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"
126-
Style="{StaticResource AccentButtonStyle}" Width="200"
127-
Click="InferNoisy_Click"/>
128-
</StackPanel>
129-
130-
<StackPanel Orientation="Vertical" Margin="11,0,0,0">
131-
<Border x:Name="DenoisedBorder" Background="LightGray" BorderBrush="LightGray" CornerRadius="5,5,0,0" Padding="0,5,0,5">
132-
<Grid Width="200">
133-
<TextBlock Text="Denoised" FontSize="18" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True" HorizontalAlignment="Center"/>
134-
</Grid>
135-
</Border>
136-
<Grid Background="LightGray" HorizontalAlignment="Center" Height="200" Width="200" VerticalAlignment="Top">
137-
<Image x:Name="DenoisedImage" Stretch="UniformToFill" Height="200" HorizontalAlignment="Center"/>
138-
</Grid>
139-
<Button Content="Classify" x:Name="InferDenoised" IsEnabled="false" FontFamily="Segoe UI Light" Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"
140-
Style="{StaticResource AccentButtonStyle}" Width="200"
141-
Click="InferDenoised_Click"/>
142-
</StackPanel>
143-
</StackPanel>
144-
</StackPanel>
145-
146-
<StackPanel Orientation="Horizontal" Grid.Row="2"
147-
Padding="0,7,0,0">
148-
<ListView
149-
x:Name="InferenceResults"
150-
HorizontalAlignment="Stretch"
151-
Padding="0,2,0,0"
152-
ItemTemplate="{StaticResource InferenceResultsTemplate}"
153-
IsItemClickEnabled="False"
154-
SingleSelectionFollowsFocus="False">
155-
<ListView.ItemContainerStyle>
156-
<Style TargetType="ListViewItem">
157-
<Setter Property="Margin" Value="1,1,1,1"/>
158-
<Setter Property="MinHeight" Value="0"/>
159-
</Style>
160-
</ListView.ItemContainerStyle>
161-
162-
<ListView.ItemsPanel>
163-
<ItemsPanelTemplate>
164-
<ItemsWrapGrid x:Name="MaxItemsWrapGrid" Orientation="Vertical" HorizontalAlignment="Stretch"/>
165-
</ItemsPanelTemplate>
166-
</ListView.ItemsPanel>
167-
</ListView>
168-
<local_controls:PerformanceMonitor x:Name="PerformanceMetricsMonitor"/>
169-
</StackPanel>
170-
</Grid>
171-
</ScrollViewer>
26+
</Flyout>
27+
</Button.Flyout>
28+
</Button>
29+
<TextBlock x:Name="Fail" FontSize="16" FontWeight="Bold"
30+
Visibility="Collapsed"
31+
Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"
32+
Foreground="Red" FontFamily="Segoe UI Light" Text="Invalid key!" VerticalAlignment="Bottom"
33+
Padding="7, 0, 0, 7"
34+
/>
35+
<TextBlock x:Name="Succeed" FontSize="16" FontWeight="Bold"
36+
Visibility="Collapsed"
37+
Typography.Capitals="AllSmallCaps" Typography.StylisticSet4="True"
38+
Foreground="Green" FontFamily="Segoe UI Light" Text="Model decrypted!" VerticalAlignment="Bottom"
39+
Padding="7, 0, 0, 7"
40+
/>
41+
42+
</StackPanel>
17243
</Grid>
17344
</Page>

0 commit comments

Comments
 (0)