thov commited on
Commit
7adf3b2
1 Parent(s): 1e5cf66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -1,8 +1,28 @@
1
  import gradio as gr
 
 
 
 
 
2
 
3
  def greet(name):
4
  return "Hello " + name + "!"
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
 
8
  demo.launch()
 
1
  import gradio as gr
2
+ import torch
3
+ from UNET_perso import UNET
4
+ import matplotlib.pyplot as plt
5
+ from src.medicalDataLoader import *
6
+
7
 
8
  def greet(name):
9
  return "Hello " + name + "!"
10
 
11
+ import torchvision
12
+ from torchvision.io import read_image
13
+
14
+ pic = read_image('Data/val/Img/patient001_01_1.png')
15
+ print(pic.shape)
16
+
17
+ model = UNET(in_channels=1, out_channels=4).to('cpu')
18
+
19
+ filepath = 'UNET_perso'
20
+ model.load_state_dict(torch.load(filepath, map_location=torch.device('cpu')))
21
+ model.eval()
22
+
23
+ plt.imshow(pic)
24
+ plt.show()
25
+
26
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
27
 
28
  demo.launch()