viewof activite1 = Inputs.text(
{label: '', value: 'coiffeur', width: 800}
)
viewof type_form = Inputs.text(
{label: 'Type de la liasse', value: 'X', width: 80}
)
urlApe1 = `https://codification-ape-dev.lab.sspcloud.fr/predict?description_activity=${activite1}%20&type_form=${type_form}&event=01P&nb_echos_max=3&prob_min=0.0009`
d3.json(urlApe1).then( res => {
var IC, results;
( {IC, ...results} = res )
IC = parseFloat(IC)
const rows = Object.values(results).map( obj => {
return `
<tr>
<td>${obj.code} | ${obj.libelle}</td>
<td>${obj.probabilite.toFixed(3)}</td>
</tr>
`
}).join('')
return html`
<table>
<caption>
Indice de confiance : ${IC.toFixed(3)}
</caption>
<tr>
<th style="text-align:center;">Libellé (NAF 2025)</th>
<th>Probabilité</th>
</tr>
${rows}
</table>`
})