radames HF staff commited on
Commit
199f296
β€’
1 Parent(s): 27d1d1c

limit models, concurrency

Browse files
Files changed (1) hide show
  1. visualizer_drag_gradio.py +5 -6
visualizer_drag_gradio.py CHANGED
@@ -159,21 +159,20 @@ def preprocess_mask_info(global_state, image):
159
 
160
 
161
  # filter large models running on SPACES
 
162
  if IS_SPACE:
163
- blocked_checkpoints = ["stylegan_human_v2_512.pkl",
164
  "stylegan2_dogs_1024_pytorch.pkl"]
165
- else:
166
- blocked_checkpoints = []
167
 
168
  valid_checkpoints_dict = {
169
  f.name.split('.')[0]: str(f)
170
  for f in Path(cache_dir).glob('*.pkl')
171
- if f.name not in blocked_checkpoints
172
  }
173
  print('Valid checkpoint file:')
174
  print(valid_checkpoints_dict)
175
 
176
- init_pkl = 'stylegan2_lions_512_pytorch'
177
 
178
  with gr.Blocks() as app:
179
  gr.Markdown("""
@@ -908,5 +907,5 @@ with gr.Blocks() as app:
908
 
909
  print("SHAReD: Start app", parser.parse_args())
910
  gr.close_all()
911
- app.queue(concurrency_count=5, max_size=200, api_open=False)
912
  app.launch(share=args.share, show_api=False)
 
159
 
160
 
161
  # filter large models running on SPACES
162
+ allowed_checkpoints = [] # all checkpoints
163
  if IS_SPACE:
164
+ allowed_checkpoints = ["stylegan_human_v2_512.pkl",
165
  "stylegan2_dogs_1024_pytorch.pkl"]
 
 
166
 
167
  valid_checkpoints_dict = {
168
  f.name.split('.')[0]: str(f)
169
  for f in Path(cache_dir).glob('*.pkl')
170
+ if f.name in allowed_checkpoints or not IS_SPACE
171
  }
172
  print('Valid checkpoint file:')
173
  print(valid_checkpoints_dict)
174
 
175
+ init_pkl = 'stylegan_human_v2_512'
176
 
177
  with gr.Blocks() as app:
178
  gr.Markdown("""
 
907
 
908
  print("SHAReD: Start app", parser.parse_args())
909
  gr.close_all()
910
+ app.queue(concurrency_count=2, max_size=200, api_open=False)
911
  app.launch(share=args.share, show_api=False)