nmouquet commited on
Commit
b721d57
1 Parent(s): 8b338aa

update synthax for updated libs

Browse files
Files changed (4) hide show
  1. .gitignore +3 -0
  2. TCGA_CS_4944.png +0 -0
  3. app.py +4 -3
  4. requirements.txt +2 -1
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .venv
2
+ flagged
3
+ __pycache__
TCGA_CS_4944.png ADDED
app.py CHANGED
@@ -12,9 +12,10 @@ torch.set_grad_enabled(False);
12
  import urllib
13
  url, filename = ("https://github.com/mateuszbuda/brain-segmentation-pytorch/raw/master/assets/TCGA_CS_4944.png", "TCGA_CS_4944.png")
14
  try: urllib.URLopener().retrieve(url, filename)
15
- except: urllib.request.urlretrieve(url, filename)
16
  def inference(img):
17
- path = img.name
 
18
  slices = [tio.ScalarImage(path).data]
19
  tensor = torch.cat(slices, dim=-1)
20
  guessed_affine = np.diag([-1, -1, 9, 1])
@@ -64,4 +65,4 @@ article = "<p style='text-align: center'><a href='https://mateuszbuda.github.io/
64
  examples = [
65
  ['TCGA_CS_4944.png']
66
  ]
67
- gr.Interface(inference, gr.inputs.Image(label="input image", type='file'), gr.outputs.Image(type='plot'), description=description, article=article, title=title, examples=examples, analytics_enabled=False).launch()
 
12
  import urllib
13
  url, filename = ("https://github.com/mateuszbuda/brain-segmentation-pytorch/raw/master/assets/TCGA_CS_4944.png", "TCGA_CS_4944.png")
14
  try: urllib.URLopener().retrieve(url, filename)
15
+ except Exception: urllib.request.urlretrieve(url, filename)
16
  def inference(img):
17
+
18
+ path = img
19
  slices = [tio.ScalarImage(path).data]
20
  tensor = torch.cat(slices, dim=-1)
21
  guessed_affine = np.diag([-1, -1, 9, 1])
 
65
  examples = [
66
  ['TCGA_CS_4944.png']
67
  ]
68
+ gr.Interface(inference, gr.Image(label="input image", type='filepath'), gr.Plot(), description=description, article=article, title=title, examples=examples, analytics_enabled=False).launch()
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  torch
2
  torchio
3
  numpy
4
- matplotlib
 
 
1
  torch
2
  torchio
3
  numpy
4
+ matplotlib
5
+ ipywidgets