jamino30 commited on
Commit
fe13422
·
verified ·
1 Parent(s): 429658f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -10,6 +10,7 @@ import numpy as np
10
  import gradio as gr
11
  from gradio_imageslider import ImageSlider
12
  from safetensors.torch import load_file
 
13
 
14
  from utils import preprocess_img, preprocess_img_from_path, postprocess_img
15
  from vgg.vgg19 import VGG_19
@@ -34,7 +35,8 @@ model = VGG_19().to(device).eval()
34
  for param in model.parameters():
35
  param.requires_grad = False
36
  sod_model = U2Net().to(device).eval()
37
- load_model_without_module(sod_model, 'u2net/saved_models/u2net-duts-msra.safetensors')
 
38
 
39
  style_files = os.listdir('./style_images')
40
  style_options = {' '.join(style_file.split('.')[0].split('_')): f'./style_images/{style_file}' for style_file in style_files}
 
10
  import gradio as gr
11
  from gradio_imageslider import ImageSlider
12
  from safetensors.torch import load_file
13
+ from huggingface_hub import hf_hub_download
14
 
15
  from utils import preprocess_img, preprocess_img_from_path, postprocess_img
16
  from vgg.vgg19 import VGG_19
 
35
  for param in model.parameters():
36
  param.requires_grad = False
37
  sod_model = U2Net().to(device).eval()
38
+ local_model_path = hf_hub_download(repo_id='jamino30/u2net-saliency', filename='u2net-duts-msra.safetensors')
39
+ load_model_without_module(sod_model, local_model_path)
40
 
41
  style_files = os.listdir('./style_images')
42
  style_options = {' '.join(style_file.split('.')[0].split('_')): f'./style_images/{style_file}' for style_file in style_files}
requirements.txt CHANGED
@@ -2,6 +2,7 @@
2
  torch
3
  torchvision
4
  safetensors
 
5
  pillow
6
  gradio
7
  gradio_imageslider
 
2
  torch
3
  torchvision
4
  safetensors
5
+ huggingface_hub
6
  pillow
7
  gradio
8
  gradio_imageslider