-
Notifications
You must be signed in to change notification settings - Fork 324
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
86 lines (80 loc) · 4.96 KB
/
Copy pathMainWindow.xaml
File metadata and controls
86 lines (80 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<Window x:Class="WindowsMLSampleForWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WindowsMLSampleForWPF"
mc:Ignorable="d"
Title="Windows ML WPF Sample - SqueezeNet Image Classification" Height="650" Width="800">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Controls Row -->
<Grid Grid.Row="0" Margin="0,0,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- Row 0: EP selection -->
<RowDefinition Height="Auto"/> <!-- Row 1: Image selection -->
<RowDefinition Height="Auto"/> <!-- Row 2: Download checkbox -->
</Grid.RowDefinitions>
<!-- Row 0: EP selection -->
<Grid Grid.Row="0" Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Execution Provider:" VerticalAlignment="Center" Margin="0,0,8,0"/>
<ComboBox x:Name="EpCombo" Grid.Column="1" Width="190" VerticalAlignment="Center"/>
<TextBlock Text="Device Type:" Grid.Column="2" Margin="16,0,8,0" VerticalAlignment="Center"/>
<ComboBox x:Name="DeviceCombo" Grid.Column="3" Width="130" VerticalAlignment="Center" IsEnabled="False"/>
<StackPanel Grid.Column="4" Orientation="Horizontal" Margin="16,0,0,0" VerticalAlignment="Center">
<TextBlock Text="Perf Mode:" VerticalAlignment="Center" Margin="0,0,8,0"/>
<RadioButton x:Name="PerfModeDefaultRadio" Content="Default" GroupName="PerfMode" IsChecked="True" VerticalAlignment="Center" Margin="0,0,8,0"/>
<RadioButton x:Name="PerfModeMaxPerfRadio" Content="Max Perf" GroupName="PerfMode" VerticalAlignment="Center" Margin="0,0,8,0"/>
<RadioButton x:Name="PerfModeMaxEffRadio" Content="Max Eff" GroupName="PerfMode" VerticalAlignment="Center"/>
</StackPanel>
<Button x:Name="ReloadSessionButton" Grid.Column="5" Content="Load / Reload Model" Padding="10,5" Margin="16,0,0,0"/>
</Grid>
<!-- Row 1: Image selection and inference -->
<Grid Grid.Row="1" Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="SelectImageButton" Click="SelectImageButton_Click" Content="Select Image" Grid.Column="0" Margin="0,0,10,0" Padding="10,5" HorizontalAlignment="Left"/>
<TextBox x:Name="ImagePathTextBox" Grid.Column="1" Margin="0,0,10,0" VerticalAlignment="Center" IsReadOnly="True" Text="No image selected"/>
<Button x:Name="RunInferenceButton" Content="Run Inference" Grid.Column="2" Padding="10,5" HorizontalAlignment="Right" Click="RunInferenceButton_Click" IsEnabled="False"/>
</Grid>
<!-- Second row: Provider download checkbox -->
<Grid Grid.Row="2">
<CheckBox x:Name="AllowProviderDownloadCheckBox" Content="Allow execution provider downloads" HorizontalAlignment="Left" IsChecked="False" Margin="0,5,0,0"/>
</Grid>
</Grid>
<!-- Image Display Row -->
<GroupBox Header="Selected Image" Grid.Row="1" Margin="0,0,0,10" MinHeight="250">
<Border BorderBrush="Gray" BorderThickness="1" Background="LightGray">
<Image x:Name="SelectedImage" Stretch="Uniform" MaxHeight="200"/>
</Border>
</GroupBox>
<!-- Results Row -->
<GroupBox Header="Classification Results" Grid.Row="2">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<TextBox x:Name="ResultsTextBox"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
IsReadOnly="True"
FontFamily="Consolas"
Background="White"
BorderThickness="0"
Text="Select an image and click 'Run Inference' to see classification results." />
</ScrollViewer>
</GroupBox>
</Grid>
</Window>