//display the pop up with more information function onClickMore(string){ document.getElementById(string).style.display ='block'; } //hide the pop up with more information function onOut(string){ document.getElementById(string).style.display ='none'; } async function getResponse(url, user_query){ try { let predictions = await fetch(url,{ method: 'POST', body: JSON.stringify({'user_query': user_query}), headers: { 'Content-type': 'application/json; charset=UTF-8', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST, GET', } }); return predictions.json() } catch (error) { console.log(error) } } //when retrieve is clicked async function onSubmit(){ let user_query = document.getElementById("exampleFormControlInput1").value // let url_query = "http://10.27.32.183:8111/predict" if (user_query != ''){ document.getElementById("spinner").style.display = 'block'; let url_query = "/predict" let predictions = await getResponse(url_query, user_query) document.getElementById("spinner").style.display = 'none'; document.getElementById("grey-container").className = 'album py-5 bg-light'; let response = predictions['predictions'] //loop through number of results html = '' var w = 0 for(let i=0; i < response.length; i++){ console.log(i) html += '
'; html += '
'; html += '
'; // library name and description html += '
'; html += '
'+ response[i]["library_name"] +'
'; html += '

'+ response[i]["Description"] +'

'; html += '
'; // end library name and description // group button bottom (View GitHub and See Usage Patterns and Configs) html += ''; html += '
'; html += '
'; // end card group button html += '
'; } //append the html to the container document.getElementById("main-parent").innerHTML = (html); html2 = '

Back to top

'; //append footer to allow going back to the top document.getElementById("footer").innerHTML = (html2); } }