File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,25 @@ <h3 class="text-indigo-600 font-bold text-center">Visualization</h3>
105105
106106
107107
108- < section id ="model-testing " class ="hidden ">
109- < h1 > Testing</ h1 >
108+ < section id ="model-testing " class ="hidden pb-20 ">
109+ < h3 class ="text-indigo-600 font-bold text-center "> Testing</ h3 >
110+
111+ < form id ="test-form ">
112+ < input type ="number " name ="input " id ="input-data " placeholder ="Enter your data here "
113+ class ="w-full mt-5 bg-gray-100 text-gray-900 py-2 px-4 rounded-md border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 ">
114+ < input type ="submit " id ="btn-process " value ="Process " class ="w-full mt-5 bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 ">
115+ </ form >
116+
117+ < div id ="prediction-result-container " class ="hidden flex-col items-start w-full sm:w-auto mt-5 p-6 bg-gray-100 border border-gray-300 rounded-lg shadow-lg ">
118+ < p > Prediction result</ p >
119+ < div class ="flex items-center justify-between w-full ">
120+ < p id ="prediction-result " class ="text-2xl sm:text-4xl text-indigo-600 font-mono font-semibold ">
121+ </ p >
122+ < button id ="btn-copy " class ="text-sm sm:text-lg text-white bg-indigo-600 py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 ">
123+ Copy
124+ </ button >
125+ </ div >
126+ </ div >
110127 </ section >
111128
112129
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ function visualize(feature, label) {
338338 const featureArray = fileData . map ( val => val [ feature ] )
339339 const maxFeatureSampleData = Math . max ( ...featureArray )
340340 const minFeatureSampleData = Math . min ( ...featureArray )
341- console . log ( maxFeatureSampleData )
341+
342342 const data = {
343343 datasets : [ {
344344 label : 'Scatter Dataset' ,
@@ -391,3 +391,24 @@ function visualize(feature, label) {
391391 chartInstance = new Chart ( ctx , config )
392392}
393393
394+
395+
396+ //////////////////////////////////////////////////
397+ //// FOURTH SECTION SCRIPT
398+ //////////////////////////////////////////////////
399+
400+ const testForm = document . getElementById ( 'test-form' )
401+ const predictionResultContainer = document . getElementById ( 'prediction-result-container' )
402+ const predictionResult = document . getElementById ( 'prediction-result' )
403+
404+ testForm . addEventListener ( 'submit' , function ( e ) {
405+ e . preventDefault ( )
406+
407+ const formData = new FormData ( this )
408+
409+ const input = formData . get ( 'input' )
410+
411+ predictionResultContainer . classList . remove ( 'hidden' )
412+ predictionResultContainer . classList . add ( 'flex' )
413+ predictionResult . textContent = equation ( parseFloat ( input ) )
414+ } )
You can’t perform that action at this time.
0 commit comments