Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import argparse
|
|
7 |
import shutil
|
8 |
import gradio as gr
|
9 |
from PIL import Image
|
|
|
10 |
|
11 |
examples = [['sample1.png'],
|
12 |
['sample2.png']]
|
@@ -40,12 +41,13 @@ def inference(img, task, run_on):
|
|
40 |
height = int(scale*height)
|
41 |
img = img.resize((width,height), Image.ANTIALIAS)
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
model = torch.jit.load('deshabby.pt')
|
48 |
|
|
|
|
|
49 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
50 |
model = model.to(device)
|
51 |
model.eval()
|
|
|
7 |
import shutil
|
8 |
import gradio as gr
|
9 |
from PIL import Image
|
10 |
+
from runpy import run_path
|
11 |
|
12 |
examples = [['sample1.png'],
|
13 |
['sample2.png']]
|
|
|
41 |
height = int(scale*height)
|
42 |
img = img.resize((width,height), Image.ANTIALIAS)
|
43 |
|
44 |
+
|
45 |
+
parameters = {'inp_channels':3, 'out_channels':3, 'dim':48, 'num_blocks':[4,6,6,8], 'num_refinement_blocks':4, 'heads':[1,2,4,8], 'ffn_expansion_factor':2.66, 'bias':False, 'LayerNorm_type':'WithBias', 'dual_pixel_task':False}
|
46 |
+
load_arch = run_path('/content/drive/MyDrive/colab/denoising_dirty_documents/Restormer/basicsr/models/archs/restormer_arch.py')
|
47 |
+
model = load_arch['Restormer'](**parameters)
|
|
|
48 |
|
49 |
+
checkpoint = torch.load('deshabby.pt')
|
50 |
+
model.load_state_dict(checkpoint['params'])
|
51 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
52 |
model = model.to(device)
|
53 |
model.eval()
|