Update app.py
Browse files
app.py
CHANGED
@@ -2,16 +2,21 @@ import streamlit as st
|
|
2 |
import cv2
|
3 |
import numpy as np
|
4 |
import torch
|
5 |
-
from torchvision import transforms
|
6 |
from PIL import Image
|
7 |
from TranSalNet_Res import TranSalNet
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Load the model and set the device
|
|
|
10 |
model = TranSalNet()
|
11 |
model.load_state_dict(torch.load('pretrained_models/TranSalNet_Res.pth', map_location=torch.device('cpu')))
|
12 |
-
model.eval()
|
13 |
-
device = torch.device('cpu')
|
14 |
model.to(device)
|
|
|
15 |
|
16 |
# Define Streamlit app
|
17 |
st.title('Saliency Detection App')
|
|
|
2 |
import cv2
|
3 |
import numpy as np
|
4 |
import torch
|
5 |
+
from torchvision import transforms, utils, models
|
6 |
from PIL import Image
|
7 |
from TranSalNet_Res import TranSalNet
|
8 |
+
from tqdm import tqdm
|
9 |
+
import torch.nn as nn
|
10 |
+
from utils.data_process import preprocess_img, postprocess_img
|
11 |
+
|
12 |
+
|
13 |
|
14 |
# Load the model and set the device
|
15 |
+
device = torch.device('cpu')
|
16 |
model = TranSalNet()
|
17 |
model.load_state_dict(torch.load('pretrained_models/TranSalNet_Res.pth', map_location=torch.device('cpu')))
|
|
|
|
|
18 |
model.to(device)
|
19 |
+
model.eval()
|
20 |
|
21 |
# Define Streamlit app
|
22 |
st.title('Saliency Detection App')
|