//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 += '
'+ response[i]["Description"] +'
'; html += '