ironjr commited on
Commit
734882d
·
verified ·
1 Parent(s): b91f391

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -93,7 +93,7 @@ opt = parser.parse_args()
93
  device = f'cuda:{opt.device}' if opt.device >= 0 else 'cpu'
94
 
95
  def download_file(url, root):
96
- local_filename = url.split('/')[-1]
97
  # NOTE the stream=True parameter below
98
  with requests.get(url, stream=True) as r:
99
  r.raise_for_status()
@@ -103,22 +103,22 @@ def download_file(url, root):
103
  # and set chunk_size parameter to None.
104
  #if chunk:
105
  f.write(chunk)
106
- return local_filename
107
 
108
 
109
  if opt.model is None:
110
  # opt.model = 'cagliostrolab/animagine-xl-3.1'
111
  # opt.model = 'ironjr/BlazingDriveV11m'
112
  # opt.model = 'KBlueLeaf/kohaku-v2.1'
113
- opt.model = 'https://huggingface.co/ironjr/BlazingDriveV13md/raw/main/blazingDrive_V13md.safetensors'
 
 
 
 
 
114
  else:
115
  if opt.model.endswith('.safetensors'):
116
  opt.model = os.path.abspath(os.path.join('checkpoints', opt.model))
117
-
118
- root = pathlib.Path(__file__).parent
119
- checkpoint_root = os.path.join(root, 'checkpoints')
120
- opt.model = download_file(opt.model, checkpoint_root)
121
- print(opt.model, checkpoint_root)
122
 
123
  # model = StreamMultiDiffusionSDXL(
124
  model = StreamMultiDiffusion(
 
93
  device = f'cuda:{opt.device}' if opt.device >= 0 else 'cpu'
94
 
95
  def download_file(url, root):
96
+ local_filename = url.split('/')[-1].split('?')[0]
97
  # NOTE the stream=True parameter below
98
  with requests.get(url, stream=True) as r:
99
  r.raise_for_status()
 
103
  # and set chunk_size parameter to None.
104
  #if chunk:
105
  f.write(chunk)
106
+ return os.path.join(root, local_filename)
107
 
108
 
109
  if opt.model is None:
110
  # opt.model = 'cagliostrolab/animagine-xl-3.1'
111
  # opt.model = 'ironjr/BlazingDriveV11m'
112
  # opt.model = 'KBlueLeaf/kohaku-v2.1'
113
+ opt.model = 'https://huggingface.co/ironjr/BlazingDriveV13md/resolve/main/blazingDrive_V13md.safetensors?download=true'
114
+
115
+ root = pathlib.Path(__file__).parent
116
+ checkpoint_root = os.path.join(root, 'checkpoints')
117
+ opt.model = download_file(opt.model, checkpoint_root)
118
+ print(opt.model, os.path.getsize(opt.model))
119
  else:
120
  if opt.model.endswith('.safetensors'):
121
  opt.model = os.path.abspath(os.path.join('checkpoints', opt.model))
 
 
 
 
 
122
 
123
  # model = StreamMultiDiffusionSDXL(
124
  model = StreamMultiDiffusion(