Srastog commited on
Commit
94e7aac
·
1 Parent(s): 6eb3411
Files changed (1) hide show
  1. app/main.py +6 -5
app/main.py CHANGED
@@ -7,10 +7,7 @@ import torchvision.transforms.functional as tf
7
  from fastapi import FastAPI, UploadFile
8
 
9
  app=FastAPI(title="Alzheimer Detection API")
10
- @app.get("/generate")
11
- def display(text: str):
12
- return {"yoy":text}
13
- """
14
  def classify_img(model,img):
15
  img=tf.to_tensor(img)
16
  img=img.unsqueeze(0)
@@ -32,6 +29,10 @@ def get_alzheimer_model():
32
 
33
 
34
 
 
 
 
 
35
  @app.post("/predict")
36
  def predict(file: UploadFile):
37
  img=Image.open(file.file).convert("RGB")
@@ -39,4 +40,4 @@ def predict(file: UploadFile):
39
  img=np.array(img)
40
  model= get_alzheimer_model()
41
  label,probability=classify_img(model,img)
42
- return {"label":label.item(),"probability":probability.item()}"""
 
7
  from fastapi import FastAPI, UploadFile
8
 
9
  app=FastAPI(title="Alzheimer Detection API")
10
+
 
 
 
11
  def classify_img(model,img):
12
  img=tf.to_tensor(img)
13
  img=img.unsqueeze(0)
 
29
 
30
 
31
 
32
+ @app.get("/")
33
+ def display():
34
+ return "Welcome to Alzheimer Detection Api"
35
+
36
  @app.post("/predict")
37
  def predict(file: UploadFile):
38
  img=Image.open(file.file).convert("RGB")
 
40
  img=np.array(img)
41
  model= get_alzheimer_model()
42
  label,probability=classify_img(model,img)
43
+ return {"label":label.item(),"probability":probability.item()}