|
| 1 | +<Views:ViewBase x:Class="TensorStack.Example.Views.TranscribeView" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:local="clr-namespace:TensorStack.Example.Views" |
| 7 | + xmlns:CommonControls="clr-namespace:TensorStack.WPF.Controls;assembly=TensorStack.WPF" |
| 8 | + xmlns:Views="clr-namespace:TensorStack.Example.Views" |
| 9 | + mc:Ignorable="d" |
| 10 | + d:DesignHeight="450" |
| 11 | + d:DesignWidth="800"> |
| 12 | + <Grid DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:TranscribeView}}}"> |
| 13 | + |
| 14 | + <Grid.RowDefinitions> |
| 15 | + <RowDefinition Height="1*" /> |
| 16 | + </Grid.RowDefinitions> |
| 17 | + |
| 18 | + <Grid Grid.Row="0" > |
| 19 | + <Grid.ColumnDefinitions> |
| 20 | + <ColumnDefinition MinWidth="360"/> |
| 21 | + <ColumnDefinition Width="5" /> |
| 22 | + <ColumnDefinition Width="4*" /> |
| 23 | + </Grid.ColumnDefinitions> |
| 24 | + |
| 25 | + |
| 26 | + <!--***Left Panel***--> |
| 27 | + <Grid Grid.Column="0"> |
| 28 | + <Border Margin="4"> |
| 29 | + <DockPanel x:Name="LeftPanelContainer" Margin="4" LastChildFill="False"> |
| 30 | + |
| 31 | + <StackPanel DockPanel.Dock="Top" IsEnabled="{Binding TextService.IsLoading, Converter={StaticResource InverseBoolConverter}}"> |
| 32 | + |
| 33 | + <!--Device Selector--> |
| 34 | + <StackPanel IsEnabled="{Binding TextService.IsLoaded, Converter={StaticResource InverseBoolConverter}}"> |
| 35 | + <TextBlock Text="Device" Style="{StaticResource FieldTextBlockStyle}" /> |
| 36 | + <ComboBox ItemsSource="{Binding Settings.Devices}" SelectedItem="{Binding SelectedDevice}" DisplayMemberPath="Name"/> |
| 37 | + </StackPanel> |
| 38 | + |
| 39 | + <!--Model Selector--> |
| 40 | + <Grid > |
| 41 | + <Grid.ColumnDefinitions> |
| 42 | + <ColumnDefinition Width="3*" /> |
| 43 | + <ColumnDefinition Width="1*" /> |
| 44 | + </Grid.ColumnDefinitions> |
| 45 | + <StackPanel Grid.Column="0" IsEnabled="{Binding TextService.IsLoaded, Converter={StaticResource InverseBoolConverter}}"> |
| 46 | + <TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" /> |
| 47 | + <ComboBox SelectedItem="{Binding SelectedModel, Mode=TwoWay}" ItemsSource="{Binding Settings.TextModels}" DisplayMemberPath="Name" /> |
| 48 | + </StackPanel> |
| 49 | + <Grid Grid.Column="1" Height="22" Margin="0,18,0,0" > |
| 50 | + <Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" /> |
| 51 | + <Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding TextService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" /> |
| 52 | + </Grid> |
| 53 | + </Grid> |
| 54 | + |
| 55 | + <StackPanel> |
| 56 | + <TextBlock Text="Audio Input" Style="{StaticResource FieldTextBlockStyle}" /> |
| 57 | + <CommonControls:AudioElement Source="{Binding AudioInput, Mode=TwoWay}" Configuration="{Binding Settings}" Progress="{Binding Progress}" Height="100" /> |
| 58 | + </StackPanel> |
| 59 | + |
| 60 | + </StackPanel> |
| 61 | + |
| 62 | + <!--Advanced--> |
| 63 | + <StackPanel DockPanel.Dock="Top" IsEnabled="{Binding TextService.IsLoaded}"> |
| 64 | + <StackPanel Margin="0,4,0,0" Visibility="{Binding Prefixes, Converter={StaticResource EmptyToVisibilityConverter}}"> |
| 65 | + <TextBlock Text="Summary Task" Style="{StaticResource FieldTextBlockStyle}" /> |
| 66 | + <ComboBox ItemsSource="{Binding Prefixes}" SelectedItem="{Binding SelectedPrefix}" /> |
| 67 | + </StackPanel> |
| 68 | + <UniformGrid Columns="4" Margin="0,4,0,0"> |
| 69 | + <StackPanel> |
| 70 | + <TextBlock Text="Min Length" Style="{StaticResource FieldTextBlockStyle}" /> |
| 71 | + <TextBox Text="{Binding MinLength}" /> |
| 72 | + </StackPanel> |
| 73 | + <StackPanel> |
| 74 | + <TextBlock Text="Max Length" Style="{StaticResource FieldTextBlockStyle}" /> |
| 75 | + <TextBox Text="{Binding MaxLength}" /> |
| 76 | + </StackPanel> |
| 77 | + <StackPanel> |
| 78 | + <TextBlock Text="Beams" Style="{StaticResource FieldTextBlockStyle}" /> |
| 79 | + <TextBox Text="{Binding Beams}" /> |
| 80 | + </StackPanel> |
| 81 | + <StackPanel> |
| 82 | + <TextBlock Text="Seed" Style="{StaticResource FieldTextBlockStyle}" /> |
| 83 | + <TextBox Text="{Binding Seed}" /> |
| 84 | + </StackPanel> |
| 85 | + <StackPanel> |
| 86 | + <TextBlock Text="TopK" Style="{StaticResource FieldTextBlockStyle}" /> |
| 87 | + <TextBox Text="{Binding TopK}" /> |
| 88 | + </StackPanel> |
| 89 | + <StackPanel> |
| 90 | + <TextBlock Text="TopP" Style="{StaticResource FieldTextBlockStyle}" /> |
| 91 | + <TextBox Text="{Binding TopP}" /> |
| 92 | + </StackPanel> |
| 93 | + <StackPanel> |
| 94 | + <TextBlock Text="Temperature" Style="{StaticResource FieldTextBlockStyle}" /> |
| 95 | + <TextBox Text="{Binding Temperature}" /> |
| 96 | + </StackPanel> |
| 97 | + <StackPanel> |
| 98 | + <TextBlock Text="LengthPenalty" Style="{StaticResource FieldTextBlockStyle}" /> |
| 99 | + <TextBox Text="{Binding LengthPenalty}" /> |
| 100 | + </StackPanel> |
| 101 | + <!--<StackPanel> |
| 102 | + <TextBlock Text="DiversityLength" Style="{StaticResource FieldTextBlockStyle}" /> |
| 103 | + <TextBox Text="{Binding DiversityLength}" /> |
| 104 | + </StackPanel>--> |
| 105 | + </UniformGrid> |
| 106 | + |
| 107 | + <UniformGrid Columns="2" Margin="0,4,0,0"> |
| 108 | + <StackPanel> |
| 109 | + <TextBlock Text="Early Stopping" Style="{StaticResource FieldTextBlockStyle}" /> |
| 110 | + <ComboBox ItemsSource="{Binding Source={StaticResource EarlyStopping}}" SelectedItem="{Binding EarlyStopping}" /> |
| 111 | + </StackPanel> |
| 112 | + <CheckBox Content="Show All Beams" IsChecked="{Binding IsMultipleResult}" Margin="0,21,0,0" HorizontalAlignment="Right"/> |
| 113 | + </UniformGrid> |
| 114 | + |
| 115 | + </StackPanel> |
| 116 | + |
| 117 | + |
| 118 | + <!--Execute/Cancel--> |
| 119 | + <UniformGrid DockPanel.Dock="Bottom" Columns="2" Height="30"> |
| 120 | + <Button Content="Cancel" Command="{Binding CancelCommand}" /> |
| 121 | + <Button Content="Summarize" Command="{Binding ExecuteCommand}" /> |
| 122 | + </UniformGrid> |
| 123 | + |
| 124 | + </DockPanel> |
| 125 | + </Border> |
| 126 | + </Grid> |
| 127 | + |
| 128 | + |
| 129 | + <!--GridSplitter--> |
| 130 | + <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Width="5" Opacity=".4" Margin="0,20" /> |
| 131 | + |
| 132 | + |
| 133 | + <!--***Middle Panel***--> |
| 134 | + <Grid Grid.Column="2" Grid.Row="0" > |
| 135 | + <Grid.ColumnDefinitions> |
| 136 | + <ColumnDefinition Width="7*" /> |
| 137 | + <ColumnDefinition Width="5" /> |
| 138 | + <ColumnDefinition Width="0" /> |
| 139 | + </Grid.ColumnDefinitions> |
| 140 | + |
| 141 | + |
| 142 | + <!--Content--> |
| 143 | + <Grid Grid.Column="0" > |
| 144 | + <Border Margin="4"> |
| 145 | + <DockPanel> |
| 146 | + <CommonControls:ProgressElement DockPanel.Dock="Bottom" Progress="{Binding Progress}" Margin="0,2,0,0"/> |
| 147 | + |
| 148 | + <Grid DockPanel.Dock="Bottom" > |
| 149 | + <TabControl ItemsSource="{Binding TranscribeResults}" SelectedIndex="{Binding SelectedBeam}" Visibility="{Binding IsMultipleResult, Converter={StaticResource BooleanToHiddenConverter}}"> |
| 150 | + <TabControl.ItemTemplate> |
| 151 | + <DataTemplate> |
| 152 | + <StackPanel> |
| 153 | + <TextBlock Text="{Binding Header}" MinWidth="100"/> |
| 154 | + <TextBlock Text="{Binding Score, StringFormat={}Score: {0:F4}}" FontSize="8" FontStyle="Italic" Opacity=".6" /> |
| 155 | + </StackPanel> |
| 156 | + </DataTemplate> |
| 157 | + </TabControl.ItemTemplate> |
| 158 | + <TabControl.ContentTemplate> |
| 159 | + <DataTemplate> |
| 160 | + <TextBox Text="{Binding Content}" TextWrapping="Wrap" IsReadOnly="True" BorderThickness="0" Margin="0,3,0,0"/> |
| 161 | + </DataTemplate> |
| 162 | + </TabControl.ContentTemplate> |
| 163 | + </TabControl> |
| 164 | + |
| 165 | + <DockPanel Margin="0,3,0,0" Visibility="{Binding IsMultipleResult, Converter={StaticResource InverseBooleanToHiddenConverter}}"> |
| 166 | + <TextBlock DockPanel.Dock="Top" Text="Transcribe Result" Style="{StaticResource FieldTextBlockStyle}" /> |
| 167 | + <TextBox Text="{Binding TranscribeResults[0].Content}" TextWrapping="Wrap" IsReadOnly="True" BorderThickness="0" /> |
| 168 | + </DockPanel> |
| 169 | + </Grid> |
| 170 | + |
| 171 | + |
| 172 | + </DockPanel> |
| 173 | + </Border> |
| 174 | + </Grid> |
| 175 | + |
| 176 | + |
| 177 | + <!--GridSplitter--> |
| 178 | + <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Width="5" Opacity=".4" Margin="0,20"/> |
| 179 | + |
| 180 | + |
| 181 | + <!--***Right Panel***--> |
| 182 | + <Grid Grid.Column="2" > |
| 183 | + <Border Margin="4"> |
| 184 | + <StackPanel> |
| 185 | + <TextBlock Text="{Binding SelectedDevice.Type, StringFormat={}Device: {0}}" /> |
| 186 | + <TextBlock Text="{Binding SelectedDevice.DeviceId, StringFormat={}DeviceId: {0}}" /> |
| 187 | + <TextBlock Text="{Binding SelectedModel.Name, StringFormat={}Model: {0}}" /> |
| 188 | + <TextBlock Text="{Binding TextService.IsLoaded, StringFormat={}IsLoaded: {0}}" /> |
| 189 | + <TextBlock Text="{Binding TextService.IsLoading, StringFormat={}IsLoading: {0}}" /> |
| 190 | + <TextBlock Text="{Binding TextService.IsExecuting, StringFormat={}IsExecuting: {0}}" /> |
| 191 | + <TextBlock Text="{Binding TextService.CanCancel, StringFormat={}CanCancel: {0}}" /> |
| 192 | + </StackPanel> |
| 193 | + </Border> |
| 194 | + </Grid> |
| 195 | + |
| 196 | + </Grid> |
| 197 | + </Grid> |
| 198 | + |
| 199 | + </Grid> |
| 200 | +</Views:ViewBase> |
0 commit comments