Zheng-MJ commited on
Commit
dfe3452
1 Parent(s): 62e96fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -13,7 +13,7 @@ from huggingface_hub import hf_hub_download
13
  from gradio_imageslider import ImageSlider
14
 
15
  ## local code
16
- from models import seemore
17
 
18
 
19
  def dict2namespace(config):
@@ -71,8 +71,8 @@ def load_network(net, load_path, strict=True, param_key='params'):
71
  net.load_state_dict(load_net, strict=strict)
72
 
73
  CONFIG = "configs/SMFANet_plus_x4SR.yml"
74
- hf_hub_download(repo_id="eduardzamfir/SeemoRe-T", filename="SeemoRe_T_X4.pth", local_dir="./")
75
- MODEL_NAME = "SeemoRe_T_X4.pth"
76
 
77
  # parse config file
78
  with open(os.path.join(CONFIG), "r") as f:
@@ -81,10 +81,7 @@ with open(os.path.join(CONFIG), "r") as f:
81
  cfg = dict2namespace(config)
82
 
83
  device = torch.device("cpu")
84
- model = seemore.SeemoRe(scale=cfg.model.scale, in_chans=cfg.model.in_chans,
85
- num_experts=cfg.model.num_experts, num_layers=cfg.model.num_layers, embedding_dim=cfg.model.embedding_dim,
86
- img_range=cfg.model.img_range, use_shuffle=cfg.model.use_shuffle, global_kernel_size=cfg.model.global_kernel_size,
87
- recursive=cfg.model.recursive, lr_space=cfg.model.lr_space, topk=cfg.model.topk)
88
 
89
  model = model.to(device)
90
  print ("IMAGE MODEL CKPT:", MODEL_NAME)
 
13
  from gradio_imageslider import ImageSlider
14
 
15
  ## local code
16
+ from models.smfanet_arch import SMFANet
17
 
18
 
19
  def dict2namespace(config):
 
71
  net.load_state_dict(load_net, strict=strict)
72
 
73
  CONFIG = "configs/SMFANet_plus_x4SR.yml"
74
+ # hf_hub_download(repo_id="eduardzamfir/SeemoRe-T", filename="SeemoRe_T_X4.pth", local_dir="./")
75
+ MODEL_NAME = "pth/SMFANet_DF2K_100w_x4SR.pth"
76
 
77
  # parse config file
78
  with open(os.path.join(CONFIG), "r") as f:
 
81
  cfg = dict2namespace(config)
82
 
83
  device = torch.device("cpu")
84
+ model = SMFANet(dim=cfg.model.dim, n_blocks=cfg.model.n_blocks, ffn_scale=cfg.model.ffn_scale, upscaling_factor=cfg.model.upscaling_factor)
 
 
 
85
 
86
  model = model.to(device)
87
  print ("IMAGE MODEL CKPT:", MODEL_NAME)