erwann commited on
Commit
cf17725
1 Parent(s): 2783b1f

add share to demo

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -36,7 +36,11 @@ def set_img_from_example(state, img):
36
  def get_cleared_mask():
37
  return gr.Image.update(value=None)
38
  class StateWrapper:
39
- """This extremely ugly code is a hacky fix to allow concurrent users on HF Spaces without instantiating new models for each user."""
 
 
 
 
40
  def create_gif(state, *args, **kwargs):
41
  return state, state[0].create_gif(*args, **kwargs)
42
  def apply_asian_vector(state, *args, **kwargs):
@@ -163,7 +167,6 @@ with gr.Blocks(css="styles.css") as demo:
163
  - Example: Higher config values, like learning rate: 0.7, perceptual loss weight: 35 can be used to make major out-of-domain changes.
164
  """)
165
  with gr.Row():
166
- # with gr.Column():
167
  presets = gr.Dropdown(value="Select a preset", label="Preset Configs", choices=["Small Masked Changes (e.g. add lipstick)", "Major Masked Changes (e.g. change hair color or nose size)", "Major Global Changes (e.g. change race / gender"])
168
  iterations = gr.Slider(minimum=10,
169
  maximum=60,
@@ -195,4 +198,4 @@ with gr.Blocks(css="styles.css") as demo:
195
  set_mask.click(StateWrapper.set_mask, inputs=[state, mask], outputs=[state, testim])
196
  presets.change(set_preset, inputs=[presets], outputs=[iterations, learning_rate, lpips_weight, reconstruction_steps])
197
  demo.queue()
198
- demo.launch(debug=True, enable_queue=True)
 
36
  def get_cleared_mask():
37
  return gr.Image.update(value=None)
38
  class StateWrapper:
39
+ """
40
+ This extremely ugly code is a hacky fix to allow concurrent users on HF Spaces,
41
+ without instantiating new models for each user, but allowing each user to have their
42
+ own image state and image history to create animations
43
+ ."""
44
  def create_gif(state, *args, **kwargs):
45
  return state, state[0].create_gif(*args, **kwargs)
46
  def apply_asian_vector(state, *args, **kwargs):
 
167
  - Example: Higher config values, like learning rate: 0.7, perceptual loss weight: 35 can be used to make major out-of-domain changes.
168
  """)
169
  with gr.Row():
 
170
  presets = gr.Dropdown(value="Select a preset", label="Preset Configs", choices=["Small Masked Changes (e.g. add lipstick)", "Major Masked Changes (e.g. change hair color or nose size)", "Major Global Changes (e.g. change race / gender"])
171
  iterations = gr.Slider(minimum=10,
172
  maximum=60,
 
198
  set_mask.click(StateWrapper.set_mask, inputs=[state, mask], outputs=[state, testim])
199
  presets.change(set_preset, inputs=[presets], outputs=[iterations, learning_rate, lpips_weight, reconstruction_steps])
200
  demo.queue()
201
+ demo.launch(debug=True, enable_queue=True, share=True)