Change number of rows depending of user input

Hello !

It’s been a long time since I’m blocking, so I’m here to ask you for help.

I have a gigantic table in .csv but it is not necessarily useful to display the entire table. My goal is to allow the user to enter the number of addresses to read (the number of lines) and the number of words to read (the number of columns) through “dcc.input”.

For now, I can only change the number of lines to read with my variable “address” (visible in the code below) but when I try to output a variable of a callback, nothing happens ! I doubt that the biggest difficulty to solve is in the callback but I do not find where exactly. Someone can help me ?

Thank you very much for your help, respectfully,
Floran D

---------------------------------------------------------------------------`

# -*- coding: utf-8 -*-
import dash
from dash.dependencies import Input, Output, State
import csv
import dash_core_components as dcc
import dash_html_components as html
import dash_table

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.figure_factory as FF

import numpy as np
import pandas as pd

import base64
import datetime
import io

import programer #importation du répertoire ou sont situes les programmes de base d'interraction avec la carte
from programer.readtest1 import readsectors #importation du programme de création d'un .csv a partir de la mémoire flash

import dash
from dash.dependencies import Input, Output
import dash_table
import dash_html_components as html
import dash_core_components as dcc
import pandas as pd

df = pd.read_csv('programer/readtest1.csv', delimiter=' ')

external_stylesheets = ['assets/css/Serv.css'] #Importation du css

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.config['suppress_callback_exceptions']=True

address = 5

def generate_table(dataframe, max_rows = address): #Utilisation des dataframes afin de générer un tableau avec des données comprises dans une seule colonne
	#print "generate table",max_rows
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        [html.Tr([
            html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
        ]) for i in range(min(len(dataframe), max_rows))]
    )
    
app.layout = html.Div( #Composition de la page
    html.Div([
		html.Div([	
			html.Div([ 														#Deuxième ligne
				html.Div([ 														#Affichage des éléments 1 - 3 à 7 à gauche
					html.H6(children='Adress'),										#Elément 4 : Adress
					dcc.Input(id='adress', placeholder='Number expected', type='text'),
					html.H6(children='Words number'),								#Elément 5 : Nombre de mots
					dcc.Input(id='words', placeholder='Number expected', type='text'),
					html.Button(id='submit-button', n_clicks=0, children='Submit'),	#Elément 6 : Bouton de confirmation
					html.Div(id='output-state'), #Ne devrais pas servir
				], className= 'two columns'
				),
				
				html.Div([ 														#CSV à droite (Elément 8)
					generate_table(df)												
				], className= 'ten columns'
				), #Fin affichage du csv
			], className="row" #Fin de la ligne
			),																#Fin deuxième ligne
		],
		),
    ],
    ) #Fin de la page
)

@app.callback(Output('output-state', 'children'),
              [Input('submit-button', 'n_clicks')],
              [State('adress', 'value'),
               State('words', 'value')])
def generate_table(dataframe, address): #Utilisation des dataframes afin de générer un tableau avec des données comprises dans une seule colonne
	#print "generate table",max_rows
    return go.layout(
		html.Table(
			# Header
			[html.Tr([html.Th(col) for col in dataframe.columns])] +

			# Body
			[html.Tr([
				html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
			]) for i in range(min(len(dataframe), address))]
		)
    )
        
if __name__ == '__main__':
   app.run_server(debug=False, host='0.0.0.0', port=80)