1616 .section { margin-bottom : 30px ; }
1717 # progressBar { width : 100% ; height : 10px ; background-color : # eee ; margin-top : 10px ; display : none; }
1818 # progressBar div { height : 100% ; background-color : # 4CAF50 ; width : 0% ; }
19+ # xColumn , # yColumn , # submitProcessing { display : none; }
1920 </ style >
2021</ head >
2122< body >
2223 < h1 > AI-DataScience-Lab</ h1 >
23- < h2 > AI Forecasting & Analysis Tool</ h2 >
24+ < h2 > Built with Pandas, scikit-learn, and OpenAI GPT-3.5 API</ h2 >
25+ < h3 > < a href ="https://github.com/Hariprashad-Ravikumar/AI-DataScience-Lab " target ="_blank " style ="font-weight: normal; font-size: 16px; "> View source code and documentation on GitHub</ a > </ h3 >
2426
2527 < div class ="section ">
2628 < form id ="uploadForm ">
27- < label for ="fileInput "> Upload CSV File</ label >
29+ < label for ="fileInput "> Choose CSV File</ label >
2830 < input type ="file " id ="fileInput " name ="file " required />
31+
32+ < button id ="loadColumnsBtn " type ="button "> Upload</ button >
2933 < div id ="progressBar "> < div > </ div > </ div >
3034
3135 < label for ="xColumn "> Independent Variable (X column)</ label >
@@ -34,10 +38,18 @@ <h2>AI Forecasting & Analysis Tool</h2>
3438 < label for ="yColumn "> Dependent Variable (Y column)</ label >
3539 < select id ="yColumn " name ="y_column " required > </ select >
3640
37- < button type ="submit "> Upload </ button >
41+ < button id =" submitProcessing " type ="submit "> Submit for Processing </ button >
3842 </ form >
3943 </ div >
4044
45+ < div class ="section ">
46+ < h3 > Choose Regression</ h3 >
47+ < select id ="regressionModel " name ="model " disabled >
48+ < option value ="linear " selected > Linear Regression (More options coming soon...)</ option >
49+ </ select >
50+ </ div >
51+
52+
4153 < div class ="section ">
4254 < h3 > Processing Log</ h3 >
4355 < pre id ="log "> Loading modules: pandas, scikit-learn, matplotlib...</ pre >
@@ -88,35 +100,37 @@ <h3>Forecast Visualization</h3>
88100 const yColumn = document . getElementById ( 'yColumn' ) ;
89101 const progressBar = document . getElementById ( 'progressBar' ) ;
90102 const progressFill = progressBar . querySelector ( 'div' ) ;
103+ const loadColumnsBtn = document . getElementById ( 'loadColumnsBtn' ) ;
104+ const submitProcessing = document . getElementById ( 'submitProcessing' ) ;
105+
106+ loadColumnsBtn . addEventListener ( 'click' , async function ( ) {
107+ const file = fileInput . files [ 0 ] ;
108+ if ( ! file ) return alert ( "Please choose a CSV file first." ) ;
91109
92- fileInput . addEventListener ( 'change' , async function ( ) {
93110 const formData = new FormData ( ) ;
94- formData . append ( 'file' , fileInput . files [ 0 ] ) ;
111+ formData . append ( 'file' , file ) ;
95112
96113 progressBar . style . display = 'block' ;
97- progressFill . style . width = '25 %' ;
114+ progressFill . style . width = '30 %' ;
98115
99116 const response = await fetch ( 'https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/get-columns' , {
100117 method : 'POST' ,
101118 body : formData
102119 } ) ;
103120
104121 const data = await response . json ( ) ;
122+ if ( ! data . columns ) return alert ( "Failed to load columns." ) ;
123+
105124 xColumn . innerHTML = '' ;
106125 yColumn . innerHTML = '' ;
107-
108126 data . columns . forEach ( col => {
109- const optionX = document . createElement ( 'option' ) ;
110- optionX . value = col ;
111- optionX . textContent = col ;
112- xColumn . appendChild ( optionX ) ;
113-
114- const optionY = document . createElement ( 'option' ) ;
115- optionY . value = col ;
116- optionY . textContent = col ;
117- yColumn . appendChild ( optionY ) ;
127+ xColumn . innerHTML += `<option value="${ col } ">${ col } </option>` ;
128+ yColumn . innerHTML += `<option value="${ col } ">${ col } </option>` ;
118129 } ) ;
119130
131+ xColumn . style . display = 'block' ;
132+ yColumn . style . display = 'block' ;
133+ submitProcessing . style . display = 'block' ;
120134 progressFill . style . width = '100%' ;
121135 setTimeout ( ( ) => progressBar . style . display = 'none' , 500 ) ;
122136 } ) ;
0 commit comments