aramis-user commited on
Commit
d6ebf48
·
verified ·
1 Parent(s): 794835d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -1,10 +1,18 @@
1
  import gradio as gr
2
- import clinicadl
 
3
 
 
 
4
 
5
- def greet(image):
6
-
7
- return "Hello " + name + "!!"
8
 
9
- demo = gr.Interface(fn=greet, inputs="image", outputs="text")
10
- demo.launch()
 
 
 
 
 
 
1
  import gradio as gr
2
+ from huggingface_hub import hf_hub_download
3
+ import torch
4
 
5
+ # Download model from Hub
6
+ model_path = hf_hub_download(repo_id="ARAMIS-LAB/CNN-AD-CN", filename="model.pth.tar")
7
 
8
+ # Load ClinicaDL model
9
+ model = torch.load(model_path, map_location="cpu")
10
+ model.eval()
11
 
12
+ def predict(input_image):
13
+ with torch.no_grad():
14
+ output = model(input_image.unsqueeze(0))
15
+ return output.numpy().tolist()
16
+
17
+ demo = gr.Interface(fn=predict, inputs="image", outputs="label")
18
+ demo.launch()