Topallaj Denis commited on
Commit
89c6b6a
·
1 Parent(s): b2db8be

changed endpoint

Browse files
Files changed (2) hide show
  1. main.py +1 -13
  2. static/script.js +2 -13
main.py CHANGED
@@ -34,20 +34,9 @@ class Item(pydantic.BaseModel):
34
  def index() -> FileResponse:
35
  return FileResponse(path="/app/static/index.html", media_type="text/html")
36
 
37
- @app.post("/unikp-predict")
38
  def predict(item: Item):
39
 
40
- sequence = item.sequence
41
- smiles = item.smiles
42
-
43
- result = {
44
- "Km": 0.0,
45
- "Kcat": 0.0,
46
- "Vmax": 0.0
47
- }
48
-
49
-
50
- """
51
  endpointHandler = EndpointHandler()
52
  result = endpointHandler.predict({
53
  "inputs": {
@@ -55,7 +44,6 @@ def predict(item: Item):
55
  "smiles": item.smiles
56
  }
57
  })
58
- """
59
 
60
  return result
61
 
 
34
  def index() -> FileResponse:
35
  return FileResponse(path="/app/static/index.html", media_type="text/html")
36
 
37
+ @app.post("/")
38
  def predict(item: Item):
39
 
 
 
 
 
 
 
 
 
 
 
 
40
  endpointHandler = EndpointHandler()
41
  result = endpointHandler.predict({
42
  "inputs": {
 
44
  "smiles": item.smiles
45
  }
46
  })
 
47
 
48
  return result
49
 
static/script.js CHANGED
@@ -2,32 +2,21 @@
2
 
3
  document.querySelector("#predict-form").addEventListener("submit", async (e) => {
4
  e.preventDefault();
5
- /*
6
  const sequence = document.querySelector("#sequence").value;
7
  const smiles = document.querySelector("#substrate").value;
8
 
9
- console.log(sequence);
10
-
11
  const data = await prediction(sequence, smiles);
12
 
13
  document.querySelector("#km-result").innerText = data.km;
14
  document.querySelector("#kcat-result").innerText = data.kcat;
15
  document.querySelector("#vmax-result").innerText = data.vmax;
16
- */
17
-
18
- await fetch("unikp-predict", {
19
- method: "POST",
20
- body: {
21
- sequence: "MGLSDGEWQLVLNVWGKVEADIAGHGQEVLIRLFKGHPETLEKFDKFKHLKSEDEMKASEDLKKHGATVLTALGGILKKKGHHEAEIKPLAQSHATKHKIPIKYLEFISEAIIHVLHSRHPGDFGADAQGAMNKALELFRKDIAAKYKELGYQG",
22
- smiles: "CC(C)C1=CC=C(C=C1)C(=O)NC1=CC=C(C=C1)C1=CC=CC=C1",
23
- }
24
- });
25
 
26
  });
27
 
28
  const prediction = async (sequence, smiles) => {
29
 
30
- const response = await fetch("unikp-predict", {
31
  method: "POST",
32
  body: {
33
  sequence: sequence,
 
2
 
3
  document.querySelector("#predict-form").addEventListener("submit", async (e) => {
4
  e.preventDefault();
5
+
6
  const sequence = document.querySelector("#sequence").value;
7
  const smiles = document.querySelector("#substrate").value;
8
 
 
 
9
  const data = await prediction(sequence, smiles);
10
 
11
  document.querySelector("#km-result").innerText = data.km;
12
  document.querySelector("#kcat-result").innerText = data.kcat;
13
  document.querySelector("#vmax-result").innerText = data.vmax;
 
 
 
 
 
 
 
 
 
14
 
15
  });
16
 
17
  const prediction = async (sequence, smiles) => {
18
 
19
+ const response = await fetch("/", {
20
  method: "POST",
21
  body: {
22
  sequence: sequence,