John6666 commited on
Commit
15cc8d7
·
verified ·
1 Parent(s): 943346a

Upload modutils.py

Browse files
Files changed (1) hide show
  1. modutils.py +2 -2
modutils.py CHANGED
@@ -5,6 +5,7 @@ import os
5
  import re
6
  from pathlib import Path
7
  from PIL import Image
 
8
  import shutil
9
  import requests
10
  from requests.adapters import HTTPAdapter
@@ -330,9 +331,8 @@ def save_gallery_history(images, files, history_gallery, history_files, progress
330
 
331
 
332
  def save_image_history(image, gallery, files, model_name: str, progress=gr.Progress(track_tqdm=True)):
333
- import numpy as np
334
  basename = f"{model_name.split('/')[-1]}_{datetime.now(FILENAME_TIMEZONE).strftime('%Y%m%d_%H%M%S')}"
335
- if image is None or (not isinstance(image, str) and not isinstance(image, Image.Image) and not isinstance(image, np.array) and not isinstance(image, tuple)): return gr.update(), gr.update()
336
  if not gallery: gallery = []
337
  if not files: files = []
338
  filename = f"{basename}.png"
 
5
  import re
6
  from pathlib import Path
7
  from PIL import Image
8
+ import numpy as np
9
  import shutil
10
  import requests
11
  from requests.adapters import HTTPAdapter
 
331
 
332
 
333
  def save_image_history(image, gallery, files, model_name: str, progress=gr.Progress(track_tqdm=True)):
 
334
  basename = f"{model_name.split('/')[-1]}_{datetime.now(FILENAME_TIMEZONE).strftime('%Y%m%d_%H%M%S')}"
335
+ if image is None or not isinstance(image, (str, Image.Image, np.array, tuple)): return gr.update(), gr.update()
336
  if not gallery: gallery = []
337
  if not files: files = []
338
  filename = f"{basename}.png"