danielsapit commited on
Commit
f7e9c78
1 Parent(s): c9247ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -31,7 +31,15 @@ def inference(input_img, is_gray, input_quality, enable_zoom, zoom, x_shift, y_s
31
 
32
  input_quality = 100 - input_quality
33
 
34
- model_path = model_name
 
 
 
 
 
 
 
 
35
 
36
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
37
 
 
31
 
32
  input_quality = 100 - input_quality
33
 
34
+ model_path = model_name
35
+
36
+ if os.path.exists(model_path):
37
+ print(f'loading model from {model_path}')
38
+ else:
39
+ os.makedirs(os.path.dirname(model_path), exist_ok=True)
40
+ url = 'https://github.com/jiaxi-jiang/FBCNN/releases/download/v1.0/{}'.format(os.path.basename(model_path))
41
+ r = requests.get(url, allow_redirects=True)
42
+ open(model_path, 'wb').write(r.content)
43
 
44
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
45