Abubakari commited on
Commit
e808895
1 Parent(s): 3bba4b2
Files changed (4) hide show
  1. Dockerfile +1 -0
  2. main.py +5 -1
  3. static/index.html +23 -0
  4. static/style.css +52 -0
Dockerfile CHANGED
@@ -6,6 +6,7 @@ COPY ./requirements.txt /code/requirements.txt
6
 
7
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
 
9
  COPY . .
10
 
11
  # Expose the port on which the application will run
 
6
 
7
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
+ COPY ./static /code/static
10
  COPY . .
11
 
12
  # Expose the port on which the application will run
main.py CHANGED
@@ -1,11 +1,15 @@
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
 
10
  def load_model():
11
  cwd = os.getcwd()
 
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()
static/index.html ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <!-- Add other input fields for PL, PR, SK, TS, M11, BD2, Age, Insurance -->
14
+
15
+ <button type="submit">Submit</button>
16
+ </form>
17
+ <p id="sepsis-result"></p>
18
+ </section>
19
+ </main>
20
+
21
+ <script src="/static/script.js"></script>
22
+ </body>
23
+ </html>
static/style.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+