vinesmsuic commited on
Commit
41c7bfd
1 Parent(s): a4cba6c

catch error

Browse files
Files changed (1) hide show
  1. serve/vote_utils.py +6 -1
serve/vote_utils.py CHANGED
@@ -10,6 +10,7 @@ from .log_utils import build_logger
10
  from .constants import IMAGE_DIR, VIDEO_DIR
11
  import imageio
12
  from diffusers.utils import load_image
 
13
 
14
  ig_logger = build_logger("gradio_web_server_image_generation", "gr_web_image_generation.log") # ig = image generation, loggers for single model direct chat
15
  igm_logger = build_logger("gradio_web_server_image_generation_multi", "gr_web_image_generation_multi.log") # igm = image generation multi, loggers for side-by-side and battle
@@ -144,10 +145,14 @@ def vote_last_response_vgm(states, vote_type, model_selectors, request: gr.Reque
144
  r = requests.get(state.output)
145
  with open(output_file, 'wb') as outfile:
146
  outfile.write(r.content)
147
- else:
148
  print("======== video shape: ========")
149
  print(state.output.shape)
150
  imageio.mimwrite(output_file, state.output, fps=8, quality=9)
 
 
 
 
151
  save_video_file_on_log_server(output_file)
152
 
153
 
 
10
  from .constants import IMAGE_DIR, VIDEO_DIR
11
  import imageio
12
  from diffusers.utils import load_image
13
+ import torch
14
 
15
  ig_logger = build_logger("gradio_web_server_image_generation", "gr_web_image_generation.log") # ig = image generation, loggers for single model direct chat
16
  igm_logger = build_logger("gradio_web_server_image_generation_multi", "gr_web_image_generation_multi.log") # igm = image generation multi, loggers for side-by-side and battle
 
145
  r = requests.get(state.output)
146
  with open(output_file, 'wb') as outfile:
147
  outfile.write(r.content)
148
+ elif isinstance(state.output, torch.Tensor):
149
  print("======== video shape: ========")
150
  print(state.output.shape)
151
  imageio.mimwrite(output_file, state.output, fps=8, quality=9)
152
+ else:
153
+ r = requests.get(state.output)
154
+ with open(output_file, 'wb') as outfile:
155
+ outfile.write(r.content)
156
  save_video_file_on_log_server(output_file)
157
 
158