Spaces:
Sleeping
Sleeping
nmouquet commited on
Commit ·
4e1491a
1
Parent(s): 4afe094
fix gradio
Browse files- .gitignore +1 -0
- TCGA_CS_4944.png +0 -0
- __pycache__/app.cpython-311.pyc +0 -0
- app.py +5 -3
- flagged/input image/63b444ef562812ef6eb4/TCGA_CS_4944.png +0 -0
- flagged/log.csv +2 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.venv
|
TCGA_CS_4944.png
ADDED
|
__pycache__/app.cpython-311.pyc
ADDED
|
Binary file (5.46 kB). View file
|
|
|
app.py
CHANGED
|
@@ -12,9 +12,11 @@ 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 |
-
|
|
|
|
|
|
|
| 18 |
slices = [tio.ScalarImage(path).data]
|
| 19 |
tensor = torch.cat(slices, dim=-1)
|
| 20 |
guessed_affine = np.diag([-1, -1, 9, 1])
|
|
@@ -64,4 +66,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.
|
|
|
|
| 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 |
+
print(f">>>>>>>>>>>>> {img}")
|
| 18 |
+
|
| 19 |
+
path = img
|
| 20 |
slices = [tio.ScalarImage(path).data]
|
| 21 |
tensor = torch.cat(slices, dim=-1)
|
| 22 |
guessed_affine = np.diag([-1, -1, 9, 1])
|
|
|
|
| 66 |
examples = [
|
| 67 |
['TCGA_CS_4944.png']
|
| 68 |
]
|
| 69 |
+
gr.Interface(inference, gr.Image(label="input image", type='filepath'), gr.Plot(), description=description, article=article, title=title, examples=examples, analytics_enabled=False).launch()
|
flagged/input image/63b444ef562812ef6eb4/TCGA_CS_4944.png
ADDED
|
flagged/log.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
input image,output,flag,username,timestamp
|
| 2 |
+
flagged\input image\63b444ef562812ef6eb4\TCGA_CS_4944.png,,,,2024-03-21 14:45:02.168756
|