Index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <v-row>
  3. <v-col cols="2">
  4. <v-btn class="mx-2" icon small color="black" @click.stop="reset">
  5. <v-icon>mdi-replay</v-icon>
  6. </v-btn>
  7. <v-btn
  8. v-show="!isTraining"
  9. class="mx-2"
  10. fab
  11. large
  12. color="primary"
  13. @click.stop="isTraining = true"
  14. >
  15. <v-icon>mdi-play</v-icon>
  16. </v-btn>
  17. <v-btn
  18. v-show="isTraining"
  19. class="mx-2"
  20. fab
  21. large
  22. color="primary"
  23. @click.stop="isTraining = false"
  24. >
  25. <v-icon>mdi-pause</v-icon>
  26. </v-btn>
  27. </v-col>
  28. <v-col cols="1">
  29. <span class="d-block label">{{ $t('playground.tf.epochNum') }}</span>
  30. <span id="epoch-number" class="d-block ma-0">000,000</span>
  31. </v-col>
  32. <v-col cols="9">
  33. <v-row>
  34. <!-- learning rate selects -->
  35. <v-col md="3">
  36. <v-select
  37. v-model="learningRate"
  38. :class="[$vuetify.breakpoint.mdAndUp ? '' : 'mb-6', 'mx-2']"
  39. :items="learningRates"
  40. menu-props="auto"
  41. hide-details
  42. :label="$t('playground.tf.learningRate')"
  43. />
  44. </v-col>
  45. <!-- optimizer selects -->
  46. <v-col md="3">
  47. <v-select
  48. v-model="optimizer"
  49. :class="[$vuetify.breakpoint.mdAndUp ? '' : 'mb-6', 'mx-2']"
  50. :items="optimizers"
  51. menu-props="auto"
  52. hide-details
  53. :label="$t('playground.tf.optimizer')"
  54. />
  55. </v-col>
  56. <!-- activation function -->
  57. <v-col md="3">
  58. <v-select
  59. v-model="activation"
  60. :class="[$vuetify.breakpoint.mdAndUp ? '' : 'mb-6', 'mx-2']"
  61. :items="activations"
  62. menu-props="auto"
  63. hide-details
  64. :label="$t('playground.tf.activation')"
  65. />
  66. </v-col>
  67. <!-- epoch -->
  68. <v-col md="3">
  69. <v-slider
  70. v-model="epoch"
  71. color="primary"
  72. track-color="grey"
  73. min="0"
  74. max="10"
  75. thumb-label
  76. :label="$t('playground.tf.epoch')"
  77. >
  78. <template v-slot:prepend>
  79. <v-icon @click="epoch--">
  80. mdi-minus
  81. </v-icon>
  82. </template>
  83. <template v-slot:append>
  84. <v-icon @click="epoch++">
  85. mdi-plus
  86. </v-icon>
  87. </template>
  88. </v-slider>
  89. </v-col>
  90. <!-- batch size -->
  91. <v-col md="3" class="my-3">
  92. <v-slider
  93. v-model="batchSize"
  94. color="primary"
  95. track-color="grey"
  96. min="10"
  97. max="400"
  98. thumb-label
  99. :label="$t('playground.tf.batchSize')"
  100. >
  101. <template v-slot:prepend>
  102. <v-icon @click="btachSize--">
  103. mdi-minus
  104. </v-icon>
  105. </template>
  106. <template v-slot:append>
  107. <v-icon @click="batchSize++">
  108. mdi-plus
  109. </v-icon>
  110. </template>
  111. </v-slider>
  112. </v-col>
  113. </v-row>
  114. </v-col>
  115. <v-col cols="12">
  116. <!-- models -->
  117. <model-board />
  118. </v-col>
  119. </v-row>
  120. </template>
  121. <script lang="ts">
  122. import Vue from 'vue'
  123. import ModelBoard from './ModelBoard.vue'
  124. const learningRates = [0.01, 0.005, 0.001, 0.0005, 0.0001]
  125. const activations = ['sigmoid', 'tanh', 'relu']
  126. const optimizers = ['adam', 'sgd', 'rmsprop']
  127. export default Vue.extend({
  128. components: {
  129. ModelBoard
  130. },
  131. data() {
  132. return {
  133. learningRates,
  134. activations,
  135. optimizers,
  136. learningRate: 0.001,
  137. activation: 'tanh',
  138. optimizer: 'rmsprop',
  139. epoch: 3,
  140. batchSize: 320,
  141. isTraining: false
  142. }
  143. }
  144. })
  145. </script>
  146. <style scoped>
  147. .label {
  148. font-size: 12px;
  149. opacity: 0.6;
  150. margin-top: 2px;
  151. }
  152. #epoch-number {
  153. font-size: 21.5px;
  154. font-weight: 300;
  155. }
  156. </style>