File size: 878 Bytes
33ce98e
b2a5411
e609b49
 
af19d5d
9e9c2d4
e609b49
 
 
 
 
 
 
663ec2b
af19d5d
 
6aad3d1
 
5eb73c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6aad3d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import streamlit as st
import huggingface_hub as hf_hub
import monai
import os
import zipfile
import torch

hf_hub.login(token=st.secrets["HF_TOKEN"])

with st.spinner("Downloading Dataset"):
    data_path = hf_hub.hf_hub_download(repo_id="osbm/prostate158", filename="data.zip", repo_type="dataset")

st.write(data_path)
with st.spinner("Unzipping..."):
    with zipfile.ZipFile(data_path, 'r') as zip_ref:
        zip_ref.extractall(".")


# st.write(os.listdir(os.getcwd()))
# st.write(os.getcwd())


model = monai.networks.nets.UNet(
    in_channels=1,
    out_channels=3,
    spatial_dims=3,
    channels=[16, 32, 64, 128, 256, 512],
    strides=[2, 2, 2, 2, 2],
    num_res_units=4,
    act="PRELU",
    norm="BATCH",
    dropout=0.15,
)

# load this model using anatomy.pt 
model.load_state_dict(torch.load('anatomy.pt', map_location=torch.device('cpu')))

print(model)