|
| 1 | +<template> |
| 2 | + <div class="container"> |
| 3 | + <div style="width: 1200px; position: absolute"> |
| 4 | + <h1>Evaluation and Explanation system</h1> |
| 5 | + <h5> |
| 6 | + In this system you will get an explanation and avaluation about those |
| 7 | + explains. |
| 8 | + </h5> |
| 9 | + <h5> |
| 10 | + Before you are using our system, we would like to ask you to get in |
| 11 | + advance a dataset and the predict model that pretrained on it. |
| 12 | + </h5> |
| 13 | + <h5> |
| 14 | + <b>Note:</b> The dataset must include the exact features that you have |
| 15 | + trained in your predict model. |
| 16 | + </h5> |
| 17 | + |
| 18 | + <!-- Styled --> |
| 19 | + <b-form @submit.prevent="onSubmit" @reset.prevent="onReset"> |
| 20 | + <b-col sm="5"> |
| 21 | + <h2>Choose a dataset</h2> |
| 22 | + |
| 23 | + <b-form-file |
| 24 | + size="sm" |
| 25 | + accept=".csv" |
| 26 | + v-model="form.dataset" |
| 27 | + :state="validateState('dataset')" |
| 28 | + placeholder="Choose a file or drop it here..." |
| 29 | + drop-placeholder="Drop file here..." |
| 30 | + ></b-form-file> |
| 31 | + <b-form-invalid-feedback v-if="!$v.form.dataset.required" |
| 32 | + >Dataset is required</b-form-invalid-feedback |
| 33 | + > |
| 34 | + </b-col> |
| 35 | + <br /> |
| 36 | + <b-col sm="5"> |
| 37 | + <h2>Choose a predict model</h2> |
| 38 | + |
| 39 | + <b-form-file |
| 40 | + size="sm" |
| 41 | + accept=".pkl" |
| 42 | + v-model="form.predict_model" |
| 43 | + :state="validateState('predict_model')" |
| 44 | + placeholder="Choose a file or drop it here..." |
| 45 | + drop-placeholder="Drop file here..." |
| 46 | + ></b-form-file> |
| 47 | + <b-form-invalid-feedback v-if="!$v.form.predict_model.required" |
| 48 | + >Predict model is required</b-form-invalid-feedback |
| 49 | + > |
| 50 | + </b-col> |
| 51 | + <br /> |
| 52 | + <b-button type="reset" style="width: 90px" variant="danger" |
| 53 | + >Reset</b-button |
| 54 | + > |
| 55 | + <b-button |
| 56 | + type="submit" |
| 57 | + variant="primary" |
| 58 | + style="width: 90px" |
| 59 | + class="ml-5 w-10" |
| 60 | + >Finish</b-button |
| 61 | + > |
| 62 | + </b-form> |
| 63 | + <b-alert |
| 64 | + class="mt-2" |
| 65 | + v-if="form.submitError" |
| 66 | + variant="warning" |
| 67 | + dismissible |
| 68 | + show |
| 69 | + >Process failed: {{ form.submitError }}</b-alert |
| 70 | + > |
| 71 | + </div> |
| 72 | + </div> |
| 73 | +</template> |
| 74 | + |
| 75 | +<script> |
| 76 | +import { |
| 77 | + required, |
| 78 | + minLength, |
| 79 | + maxLength, |
| 80 | + alpha, |
| 81 | + sameAs, |
| 82 | + email, |
| 83 | +} from "vuelidate/lib/validators"; |
| 84 | +export default { |
| 85 | + data() { |
| 86 | + return { |
| 87 | + form: { |
| 88 | + dataset: null, |
| 89 | + predict_model: null, |
| 90 | + submitError:undefined |
| 91 | + }, |
| 92 | + }; |
| 93 | + }, |
| 94 | + validations: { |
| 95 | + form: { |
| 96 | + dataset: { |
| 97 | + required, |
| 98 | + }, |
| 99 | + predict_model: { |
| 100 | + required, |
| 101 | + }, |
| 102 | + }, |
| 103 | + }, |
| 104 | + methods: { |
| 105 | + onReset() { |
| 106 | + this.form = { |
| 107 | + dataset: null, |
| 108 | + predict_model: null, |
| 109 | + }; |
| 110 | + this.$refs.fileinput.reset(); |
| 111 | +
|
| 112 | + this.$nextTick(() => { |
| 113 | + this.$v.$reset(); |
| 114 | + }); |
| 115 | + }, |
| 116 | + onSubmit() { |
| 117 | + this.$v.form.$touch(); |
| 118 | + if (this.$v.form.$anyError) { |
| 119 | + return; |
| 120 | + } |
| 121 | + this.createExplanationValuation(); |
| 122 | + }, |
| 123 | + async createExplanationValuation() { |
| 124 | + try { |
| 125 | + const response = await this.axios.post( |
| 126 | + "http://localhost:3000/evaluation", // to fix it |
| 127 | + { |
| 128 | + dataset: this.form.dataset, |
| 129 | + predict_model: this.form.predict_model, |
| 130 | + } |
| 131 | + ); |
| 132 | + if (response.status == "201") { |
| 133 | + this.$router.push("/evaluation"); |
| 134 | + } |
| 135 | + } catch (err) { |
| 136 | + this.form.submitError = err.response.data.message; |
| 137 | + } |
| 138 | + }, |
| 139 | + validateState(param) { |
| 140 | + const { $dirty, $error } = this.$v.form[param]; |
| 141 | + return $dirty ? !$error : null; |
| 142 | + }, |
| 143 | + }, |
| 144 | +}; |
| 145 | +</script> |
| 146 | + |
| 147 | +<style scoped> |
| 148 | +</style> |
0 commit comments