File size: 841 Bytes
52a9235
 
0beca83
52a9235
0beca83
 
52a9235
8d6ce18
 
b0ad71a
52a9235
0beca83
 
 
52a9235
2903c7f
b0ad71a
0fa1652
 
 
 
 
 
 
 
 
b0ad71a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"use strict";

document.querySelector("#predict-form").addEventListener("submit", async (e) => {
	e.preventDefault();
	const sequence = document.querySelector("#sequence").value;
	const smiles = document.querySelector("#substrate").value;

	console.log(sequence);

	const data = await prediction(sequence, smiles);

	document.querySelector("#km-result").innerText = data.km;
	document.querySelector("#kcat-result").innerText = data.kcat;
	document.querySelector("#vmax-result").innerText = data.vmax;
});

const prediction = async (sequence, smiles) => {
	// send POST request with FormData
	const formData = new FormData();
	formData.append("sequence", sequence);
	formData.append("smiles", smiles);

	const response = await fetch("/predict", {
		method: "POST",
		body: formData,
	});
	const data = await response.json();
	return data;
};