title: Bad Request The browser (or proxy) sent a request that this server could not understand in flask
body: <p>I am trying to develop a data application with flask. After loading the dataset, I want to selectively train the x and y columns of the data myself. But I'm getting this error.
  &quot;Bad Request
  The browser (or proxy) sent a request that this server could not understand.&quot;
  I am using the dataset
  <a href="https://archive.ics.uci.edu/ml/machine-learning-databases/00477/" rel="nofollow noreferrer">https://archive.ics.uci.edu/ml/machine-learning-databases/00477/</a> in this link.
  I will be grateful if you could help me.</p>
  <p>index.hmtl and app.py</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;!-- jQuery library --&gt;
      &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  
      &lt;!-- JS &amp; CSS library of MultiSelect plugin --&gt;
      &lt;script src=&quot;multiselect/jquery.multiselect.js&quot;&gt;&lt;/script&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;multiselect/jquery.multiselect.css&quot;&gt;
      {{data | safe}}
      &lt;style&gt;
          .container{
              padding:20px;
              position: relative;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form class=&quot;&quot; action=&quot;data&quot; method=&quot;post&quot;&gt;
      
          &lt;input type=&quot;file&quot; name=&quot;upload_file&quot; value=&quot;&quot;&gt;
          &lt;input type=&quot;submit&quot; name=&quot;upload_file&quot; value=&quot;submit&quot;&gt;
      
      &lt;/form&gt;  
      
      &lt;div class=&quot;container&quot;&gt;
      &lt;select name=&quot;x_columns[]&quot; multiple id=&quot;x&quot;&gt;
      &lt;option value=&quot;X1&quot;&gt;X1&lt;/option&gt;
      &lt;option value=&quot;X2&quot;&gt;X2&lt;/option&gt;
      &lt;option value=&quot;X3&quot;&gt;X3&lt;/option&gt;
      &lt;option value=&quot;X4&quot;&gt;X4&lt;/option&gt;
      &lt;option value=&quot;X5&quot;&gt;X5&lt;/option&gt;
      &lt;option value=&quot;X6&quot;&gt;X6&lt;/option&gt;
      &lt;option value=&quot;Y&quot;&gt;Y&lt;/option&gt;
      &lt;/select&gt;
      &lt;script&gt;
      $('#x_columns[]').multiselect({
          columns: 1,
          placeholder: 'Select X Columns'
      });
  &lt;/script&gt;&lt;/div&gt; 
  
        
  &lt;div class=&quot;container&quot;&gt;
      &lt;select name=&quot;y_columns[]&quot; multiple id=&quot;y&quot;&gt;
      &lt;option value=&quot;X1&quot;&gt;X1&lt;/option&gt;
      &lt;option value=&quot;X2&quot;&gt;X2&lt;/option&gt;
      &lt;option value=&quot;X3&quot;&gt;X3&lt;/option&gt;
      &lt;option value=&quot;X4&quot;&gt;X4&lt;/option&gt;
      &lt;option value=&quot;X5&quot;&gt;X5&lt;/option&gt;
      &lt;option value=&quot;X6&quot;&gt;X6&lt;/option&gt;
      &lt;option value=&quot;Y&quot;&gt;Y&lt;/option&gt;
  &lt;/select&gt;
  &lt;script&gt;
      $('#y_columns[]').multiselect({
          columns: 1,
          placeholder: 'Select Y Columns'
      });
  &lt;/script&gt;&lt;/div&gt; 
  &lt;p name=&quot;y_columns[]&quot;&gt; dogru&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  
  import pandas as pd
  from flask import Flask,render_template,request
  from sklearn.model_selection import train_test_split
  from sklearn import preprocessing
  from pyGRNN import GRNN
  from sklearn.metrics import mean_squared_error as MSE
  app = Flask(__name__)
  
  @app.route('/',methods=['GET','POST'])
  def index():
      return render_template('index.html')
  
  @app.route('/data',methods=['GET','POST'])
  def show_data():
   
      if request.method=='POST':
          file=request.form['upload_file']
          data=pd.read_excel(file)
          #return render_template('index.html',data=data.to_html())
  
          x_names=[]
          
          y_names=[]
          x_names=request.form['x_columns[]']
          print(x_names)
          y_names=request.form['y_columns[]']
          print(y_names)
          
          X=data[x_names]
          Y=data[y_names]
          x_train, x_test, y_train, y_test = train_test_split(preprocessing.minmax_scale(X),  Y,    test_size=0.2,)
          IGRNN = GRNN(bnds=(0, None), calibration='None', kernel='RBF', method='L-BFGS-B',
                      n_restarts_optimizer=0, n_splits=5, seed=42, sigma=input)  
          IGRNN.fit(x_train, y_train.ravel())
          y_pred = IGRNN.predict(x_test)
          mse_IGRNN = MSE(y_test, y_pred)
          
          return render_template('index.html',mse_IGRNN,data=data.to_html())
  
  if __name__=='__main__':
      app.run(debug=True)
  </code></pre>