Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +73 -278
templates/index.html
CHANGED
@@ -4,286 +4,81 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
7 |
-
<title>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
.image-part{height:300px;width:300px;border:1px solid #1b2d6b;}
|
16 |
-
.image-part img{position:absolute;height: 300px;width:300px;display:none;padding:5px;}
|
17 |
-
.image-part #video{display:block;height: 300px;width:300px;padding:5px;}
|
18 |
-
.res-part{border:1px solid #dedede;margin-left:20px;height: 310px;width:100%;padding:5px;margin:0px auto;overflow:auto;}
|
19 |
-
.res-part2{border:1px solid #dedede;height: 310px;width:100%;padding:5px;margin:0px auto;}
|
20 |
-
.resp-img{height: 298px;width: 233px;margin:0px auto;}
|
21 |
-
.jsonRes{margin-left:30px;}
|
22 |
-
#send{cursor:pointer;}
|
23 |
-
.btn-part{width:325px;}
|
24 |
-
textarea,
|
25 |
-
select,
|
26 |
-
.form-control,
|
27 |
-
.custom-select,
|
28 |
-
button.btn,
|
29 |
-
.btn-primary,
|
30 |
-
input[type="text"],
|
31 |
-
input[type="url"],
|
32 |
-
.uneditable-input{
|
33 |
-
border: 1px solid #363e75;
|
34 |
-
outline: 0 !important;
|
35 |
-
border-radius:0px;
|
36 |
-
box-shadow: none;
|
37 |
-
-webkit-box-shadow: none;
|
38 |
-
-moz-box-shadow: none;
|
39 |
-
-moz-transition: none;
|
40 |
-
-webkit-transition: none;
|
41 |
-
}
|
42 |
-
textarea:focus,
|
43 |
-
select:focus,
|
44 |
-
.form-control:focus,
|
45 |
-
.btn:focus,
|
46 |
-
.btn-primary:focus,
|
47 |
-
.custom-select:focus,
|
48 |
-
input[type="text"]:focus,
|
49 |
-
.uneditable-input:focus{
|
50 |
-
border: 1px solid #007bff;
|
51 |
-
outline: 0 !important;
|
52 |
-
border-radius:0px;
|
53 |
-
box-shadow: none;
|
54 |
-
-webkit-box-shadow: none;
|
55 |
-
-moz-box-shadow: none;
|
56 |
-
-moz-transition: none;
|
57 |
-
-webkit-transition: none;
|
58 |
-
}
|
59 |
-
#loading {
|
60 |
-
position: fixed;
|
61 |
-
left: 0px;
|
62 |
-
top: 0px;
|
63 |
-
width: 100%;
|
64 |
-
height: 100%;
|
65 |
-
z-index: 9999999999;
|
66 |
-
overflow: hidden;
|
67 |
-
background: rgba(255, 255, 255, 0.7);
|
68 |
-
}
|
69 |
-
.loader {
|
70 |
-
border: 8px solid #f3f3f3;
|
71 |
-
border-top: 8px solid #363e75;
|
72 |
-
border-radius: 50%;
|
73 |
-
width: 60px;
|
74 |
-
height: 60px;
|
75 |
-
left: 50%;
|
76 |
-
margin-left: -4em;
|
77 |
-
display: block;
|
78 |
-
animation: spin 2s linear infinite;
|
79 |
-
}
|
80 |
-
.loader,
|
81 |
-
.loader:after {display: block;position: absolute;top: 50%;margin-top: -4.05em;}
|
82 |
-
@keyframes spin {
|
83 |
-
0% {
|
84 |
-
transform: rotate(0deg);
|
85 |
-
}
|
86 |
-
100% {
|
87 |
-
transform: rotate(360deg);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
.right-part{border:1px solid #dedede;padding:5px;}
|
91 |
-
.logo{position:absolute;right:0px;bottom:0px;margin-right:30px;margin-bottom:30px;}
|
92 |
-
</style>
|
93 |
-
<script>
|
94 |
-
let programs = {{ programs|tojson }}; // Passing programs from the backend as a JSON object
|
95 |
-
|
96 |
-
// Update the courses dropdown when a program is selected
|
97 |
-
function updateCourses() {
|
98 |
-
const programSelect = document.getElementById("program");
|
99 |
-
const courseSelect = document.getElementById("course");
|
100 |
-
const selectedProgram = programSelect.value;
|
101 |
-
|
102 |
-
// Clear existing options in the course dropdown
|
103 |
-
courseSelect.innerHTML = "<option value=''>--Select a course--</option>";
|
104 |
-
document.getElementById("course_outcomes").value = ""; // Clear the course outcomes
|
105 |
-
|
106 |
-
if (selectedProgram && programs[selectedProgram]) {
|
107 |
-
const courses = Object.keys(programs[selectedProgram]);
|
108 |
-
courses.forEach(course => {
|
109 |
-
let option = document.createElement("option");
|
110 |
-
option.value = course;
|
111 |
-
option.text = course;
|
112 |
-
courseSelect.appendChild(option);
|
113 |
-
});
|
114 |
-
}
|
115 |
}
|
116 |
-
|
117 |
-
|
118 |
-
function updateCourseOutcomes() {
|
119 |
-
const programSelect = document.getElementById("program").value;
|
120 |
-
const courseSelect = document.getElementById("course").value;
|
121 |
-
const courseOutcomes = programs[programSelect] ? programs[programSelect][courseSelect] : [];
|
122 |
-
|
123 |
-
const courseOutcomesTextArea = document.getElementById("course_outcomes");
|
124 |
-
courseOutcomesTextArea.value = courseOutcomes ? courseOutcomes.join("\n") : "";
|
125 |
}
|
126 |
-
|
|
|
|
|
|
|
|
|
127 |
</head>
|
128 |
<body>
|
129 |
-
<div class="
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
</ul></div></div>
|
187 |
-
</div>
|
188 |
-
</div>
|
189 |
-
</div>
|
190 |
-
</section>
|
191 |
-
</div>
|
192 |
-
|
193 |
-
<img class="logo" src="" />
|
194 |
-
|
195 |
-
|
196 |
-
<div id="loading"></div>
|
197 |
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
198 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
199 |
-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
200 |
-
|
201 |
-
<script>
|
202 |
-
var mybtn = document.getElementById('startbtn');
|
203 |
-
var myvideo = document.getElementById('video');
|
204 |
-
var mycanvas = document.getElementById('canvas');
|
205 |
-
var myphoto = document.getElementById('photo');
|
206 |
-
var base_data = "";
|
207 |
-
|
208 |
-
function sendRequest(base64Data){
|
209 |
-
var type = "json";
|
210 |
-
if(base64Data != "" || base64Data != null){
|
211 |
-
if(type == "imgtobase"){
|
212 |
-
$(".res-part").html("");
|
213 |
-
$(".res-part").html(base64Data);
|
214 |
-
}
|
215 |
-
else if(type == "basetoimg"){
|
216 |
-
var imageData = $("#imgstring").val();
|
217 |
-
$(".res-part").html("");
|
218 |
-
$(".res-part").append("<img src='data:image/jpeg;base64," + imageData + "' alt='' />");
|
219 |
-
}
|
220 |
-
else{
|
221 |
-
var url = $("#url").val();
|
222 |
-
$("#loading").show();
|
223 |
-
$.ajax({
|
224 |
-
url : url,
|
225 |
-
type: "post",
|
226 |
-
cache: false,
|
227 |
-
async: true,
|
228 |
-
crossDomain: true,
|
229 |
-
headers: {
|
230 |
-
'Content-Type': 'application/json',
|
231 |
-
'Access-Control-Allow-Origin':'*'
|
232 |
-
},
|
233 |
-
data:JSON.stringify({image:base64Data}),
|
234 |
-
success: function(res){
|
235 |
-
$(".res-part").html("");
|
236 |
-
$(".res-part2").html("");
|
237 |
-
try{
|
238 |
-
var imageData = res[1].image;
|
239 |
-
if(imageData.length > 100){
|
240 |
-
if(imageData.length > 10){$(".res-part2").append("<img class='resp-img' src='data:image/jpeg;base64," + imageData + "' alt='' />");}
|
241 |
-
}
|
242 |
-
}catch(e){}
|
243 |
-
$(".res-part").html("<pre>" + JSON.stringify(res[0], undefined, 2) + "</pre>");
|
244 |
-
$("#loading").hide();
|
245 |
-
}
|
246 |
-
});
|
247 |
-
}
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
$(document).ready(function(){
|
252 |
-
$("#loading").hide();
|
253 |
-
|
254 |
-
$('#send').click(function(evt){
|
255 |
-
sendRequest(base_data);
|
256 |
-
});
|
257 |
-
|
258 |
-
$('#uload').click(function(evt) {
|
259 |
-
$('#fileinput').focus().trigger('click');
|
260 |
-
});
|
261 |
-
$("#fileinput").change(function(){
|
262 |
-
if (this.files && this.files[0]){
|
263 |
-
var reader = new FileReader();
|
264 |
-
reader.onload = function (e){
|
265 |
-
var url = e.target.result;
|
266 |
-
var img = new Image();
|
267 |
-
img.crossOrigin = 'Anonymous';
|
268 |
-
img.onload = function(){
|
269 |
-
var canvas = document.createElement('CANVAS');
|
270 |
-
var ctx = canvas.getContext('2d');
|
271 |
-
canvas.height = this.height;
|
272 |
-
canvas.width = this.width;
|
273 |
-
ctx.drawImage(this, 0, 0);
|
274 |
-
base_data = canvas.toDataURL('image/jpeg', 1.0).replace(/^data:image.+;base64,/, '');
|
275 |
-
canvas = null;
|
276 |
-
};
|
277 |
-
img.src = url;
|
278 |
-
$('#photo').attr('src', url);
|
279 |
-
$('#photo').show();
|
280 |
-
$('#video').hide();
|
281 |
-
}
|
282 |
-
reader.readAsDataURL(this.files[0]);
|
283 |
-
}
|
284 |
-
});
|
285 |
-
});
|
286 |
-
|
287 |
-
</script>
|
288 |
</body>
|
289 |
-
</html>
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
7 |
+
<title>CLOs - PLOs Mapping</title>
|
8 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
9 |
+
<style>
|
10 |
+
/* Custom styles */
|
11 |
+
body { background-color: #eff2f9; }
|
12 |
+
h3 { color: #1b2d6b; font-size: 30px; font-weight: 700; }
|
13 |
+
textarea, select, .form-control, button.btn, input[type="text"] {
|
14 |
+
border: 1px solid #363e75; border-radius: 0px; box-shadow: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
+
textarea:focus, select:focus, .form-control:focus, button:focus, input[type="text"]:focus {
|
17 |
+
border: 1px solid #007bff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
+
.error-message {
|
20 |
+
color: red;
|
21 |
+
font-size: 14px;
|
22 |
+
}
|
23 |
+
</style>
|
24 |
</head>
|
25 |
<body>
|
26 |
+
<div class="container">
|
27 |
+
<section class="mt-5">
|
28 |
+
<h3 class="text-center">CLOs - PLOs Mapping Using Large Language Models</h3>
|
29 |
+
<hr>
|
30 |
+
|
31 |
+
<!-- Model Selection -->
|
32 |
+
<form action="/set_model" method="post">
|
33 |
+
<label for="model_name">Choose a Model:</label>
|
34 |
+
<select id="model_name" name="model_name" class="custom-select mb-3">
|
35 |
+
<option value="sentence-transformers/all-mpnet-base-v2" selected>all-mpnet-base-v2</option>
|
36 |
+
<option value="sentence-transformers/bert-base-nli-mean-tokens">bert-base-nli-mean-tokens</option>
|
37 |
+
<option value="thuan9889/llama_embedding_model_v1">llama_embedding_model_v1</option>
|
38 |
+
<option value="sembeddings/model_gpt_trained">model_gpt_trained</option>
|
39 |
+
</select>
|
40 |
+
<button type="submit" class="btn btn-primary">Set Model</button>
|
41 |
+
</form>
|
42 |
+
|
43 |
+
<h5>Current Model: {{ model_name }}</h5>
|
44 |
+
{% if message %}
|
45 |
+
<p style="color: red;">{{ message }}</p>
|
46 |
+
{% endif %}
|
47 |
+
<hr>
|
48 |
+
|
49 |
+
<!-- CLOs and PLOs Entry Form -->
|
50 |
+
<form action="/match" method="post" onsubmit="return validatePLOs()">
|
51 |
+
<div class="form-group">
|
52 |
+
<label for="course_outcomes">Course Learning Outcomes (CLOs):</label>
|
53 |
+
<textarea id="course_outcomes" name="course_outcomes" rows="5" class="form-control" placeholder="Enter CLOs here"></textarea>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<div class="form-group">
|
57 |
+
<label for="program_outcomes">Program Learning Outcomes (PLOs):</label>
|
58 |
+
<textarea id="program_outcomes" name="program_outcomes" rows="5" class="form-control" placeholder="Enter up to 6 PLOs here"></textarea>
|
59 |
+
<small class="text-muted">Enter only up to six PLOs, each on a new line.</small>
|
60 |
+
<p id="plo-error" class="error-message"></p> <!-- Error message area -->
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<button type="submit" class="btn btn-primary">Submit</button>
|
64 |
+
</form>
|
65 |
+
</section>
|
66 |
+
</div>
|
67 |
+
|
68 |
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
69 |
+
<script>
|
70 |
+
function validatePLOs() {
|
71 |
+
const ploTextarea = document.getElementById('program_outcomes');
|
72 |
+
const errorElement = document.getElementById('plo-error');
|
73 |
+
const plos = ploTextarea.value.trim().split('\n').filter(line => line.trim() !== '');
|
74 |
+
|
75 |
+
if (plos.length > 6) {
|
76 |
+
errorElement.textContent = "Please enter only up to six PLOs.";
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
errorElement.textContent = ""; // Clear the error message if valid
|
80 |
+
return true;
|
81 |
+
}
|
82 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
</body>
|
84 |
+
</html>
|