Abubakari commited on
Commit
e1afd8c
1 Parent(s): 1ef167e
Files changed (4) hide show
  1. main.py +3 -5
  2. static/index.html +0 -39
  3. static/script.js +0 -23
  4. static/style.css +0 -52
main.py CHANGED
@@ -1,15 +1,13 @@
1
  import pandas as pd
2
  import joblib
3
- from fastapi import FastAPI, Request
4
- from fastapi.staticfiles import StaticFiles
5
- from fastapi.templating import Jinja2Templates
6
  import uvicorn
7
  import numpy as np
8
  import os
9
 
10
  app = FastAPI()
11
- app.mount("/static", StaticFiles(directory="static"), name="static")
12
- templates = Jinja2Templates(directory="templates")
13
 
14
  def load_model():
15
  cwd = os.getcwd()
 
1
  import pandas as pd
2
  import joblib
3
+ from fastapi import FastAPI
 
 
4
  import uvicorn
5
  import numpy as np
6
  import os
7
 
8
  app = FastAPI()
9
+ #app.mount("/static", StaticFiles(directory="static"), name="static")
10
+ #templates = Jinja2Templates(directory="templates")
11
 
12
  def load_model():
13
  cwd = os.getcwd()
static/index.html DELETED
@@ -1,39 +0,0 @@
1
- <!-- index.html -->
2
- <html>
3
- <head>
4
- <link rel="stylesheet" type="text/css" href="/static/style.css">
5
- </head>
6
- <body>
7
- <main>
8
- <section id="sepsis-prediction">
9
- <h2>Sepsis Prediction</h2>
10
- <form action="/sepsis/predict" method="get">
11
- <label for="PRG">PRG:</label>
12
- <input type="number" name="PRG" step="any" required><br>
13
- <label for="PL">PL:</label>
14
- <input type="number" name="PL" step="any" required><br>
15
- <label for="PR">PR:</label>
16
- <input type="number" name="PR" step="any" required><br>
17
- <label for="SK">SK:</label>
18
- <input type="number" name="SK" step="any" required><br>
19
- <label for="TS">TS:</label>
20
- <input type="number" name="TS" step="any" required><br>
21
- <label for="M11">M11:</label>
22
- <input type="number" name="M11" step="any" required><br>
23
- <label for="BD2">BD2:</label>
24
- <input type="number" name="BD2" step="any" required><br>
25
- <label for="Age">Age:</label>
26
- <input type="number" name="Age" step="any" required><br>
27
- <label for="Insurance">Insurance:</label>
28
- <input type="number" name="Insurance" step="any" required><br>
29
- <!-- Add other input fields for PL, PR, SK, TS, M11, BD2, Age, Insurance -->
30
-
31
- <button type="submit">Submit</button>
32
- </form>
33
- <p id="sepsis-result"></p>
34
- </section>
35
- </main>
36
-
37
- <script src="/static/script.js"></script>
38
- </body>
39
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/script.js DELETED
@@ -1,23 +0,0 @@
1
- document.addEventListener('DOMContentLoaded', () => {
2
- const form = document.querySelector('#sepsis-prediction form');
3
- const result = document.querySelector('#sepsis-result');
4
-
5
- form.addEventListener('submit', async (event) => {
6
- event.preventDefault();
7
-
8
- const formData = new FormData(form);
9
- const urlParams = new URLSearchParams(formData);
10
- const url = `/sepsis/predict?${urlParams.toString()}`;
11
-
12
- try {
13
- const response = await fetch(url);
14
- const data = await response.json();
15
-
16
- result.textContent = data.statement;
17
- } catch (error) {
18
- console.error('Error:', error);
19
- result.textContent = 'An error occurred while processing the request.';
20
- }
21
- });
22
- });
23
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/style.css DELETED
@@ -1,52 +0,0 @@
1
- /* style.css */
2
- body {
3
- font-family: Arial, sans-serif;
4
- margin: 0;
5
- padding: 0;
6
- }
7
-
8
- main {
9
- max-width: 600px;
10
- margin: 0 auto;
11
- padding: 20px;
12
- }
13
-
14
- h2 {
15
- font-size: 24px;
16
- margin-bottom: 10px;
17
- }
18
-
19
- form {
20
- margin-bottom: 20px;
21
- }
22
-
23
- label {
24
- display: block;
25
- margin-bottom: 5px;
26
- }
27
-
28
- input[type="number"] {
29
- width: 100%;
30
- padding: 10px;
31
- margin-bottom: 10px;
32
- border: 1px solid #ccc;
33
- border-radius: 4px;
34
- }
35
-
36
- button[type="submit"] {
37
- padding: 10px 20px;
38
- background-color: #4caf50;
39
- color: white;
40
- border: none;
41
- border-radius: 4px;
42
- cursor: pointer;
43
- }
44
-
45
- button[type="submit"]:hover {
46
- background-color: #45a049;
47
- }
48
-
49
- #sepsis-result {
50
- font-weight: bold;
51
- }
52
-