text: import NiblackThresholding from '../../lib/model/niblack.js'
  
  var dispNiblackThresholding = function (elm, platform) {
  	platform.colorSpace = 'gray'
  	const fitModel = () => {
  		const n = +elm.select('[name=n]').property('value')
  		const k = +elm.select('[name=k]').property('value')
  		platform.fit((tx, ty, pred_cb) => {
  			const model = new NiblackThresholding(n, k)
  			const y = model.predict(tx)
  			pred_cb(y.flat())
  		}, 1)
  	}
  
  	elm.append('span').text(' n ')
  	elm.append('input')
  		.attr('type', 'number')
  		.attr('name', 'n')
  		.attr('value', 3)
  		.attr('min', 3)
  		.attr('max', 99)
  		.attr('step', 2)
  		.on('change', fitModel)
  	elm.append('span').text(' k ')
  	elm.append('input')
  		.attr('type', 'number')
  		.attr('name', 'k')
  		.attr('value', 0.1)
  		.attr('min', -100)
  		.attr('max', 100)
  		.attr('step', 0.1)
  		.on('change', fitModel)
  	elm.append('input').attr('type', 'button').attr('value', 'Fit').on('click', fitModel)
  }
  
  export default function (platform) {
  	platform.setting.ml.usage = 'Click "Fit" button.'
  	dispNiblackThresholding(platform.setting.ml.configElement, platform)
  }
  