fffiloni commited on
Commit
529fb74
1 Parent(s): 6426e9a

disable advanced settings on shared UI

Browse files
Files changed (1) hide show
  1. webgui.py +27 -17
webgui.py CHANGED
@@ -35,6 +35,10 @@ huggingface_hub.snapshot_download(
35
  local_dir_use_symlinks=False,
36
  )
37
 
 
 
 
 
38
  default_values = {
39
  "width": 512,
40
  "height": 512,
@@ -224,26 +228,26 @@ with gr.Blocks() as demo:
224
  with gr.Column():
225
  uploaded_img = gr.Image(type="filepath", label="Reference Image")
226
  uploaded_audio = gr.Audio(type="filepath", label="Input Audio")
227
- with gr.Accordion("Advanced Configuration", open=False):
228
  with gr.Row():
229
- width = gr.Slider(label="Width", minimum=128, maximum=1024, value=default_values["width"])
230
- height = gr.Slider(label="Height", minimum=128, maximum=1024, value=default_values["height"])
231
  with gr.Row():
232
- length = gr.Slider(label="Length", minimum=100, maximum=5000, value=default_values["length"])
233
- seed = gr.Slider(label="Seed", minimum=0, maximum=10000, value=default_values["seed"])
234
  with gr.Row():
235
- facemask_dilation_ratio = gr.Slider(label="Facemask Dilation Ratio", minimum=0.0, maximum=1.0, step=0.01, value=default_values["facemask_dilation_ratio"])
236
- facecrop_dilation_ratio = gr.Slider(label="Facecrop Dilation Ratio", minimum=0.0, maximum=1.0, step=0.01, value=default_values["facecrop_dilation_ratio"])
237
  with gr.Row():
238
- context_frames = gr.Slider(label="Context Frames", minimum=0, maximum=50, step=1, value=default_values["context_frames"])
239
- context_overlap = gr.Slider(label="Context Overlap", minimum=0, maximum=10, step=1, value=default_values["context_overlap"])
240
  with gr.Row():
241
- cfg = gr.Slider(label="CFG", minimum=0.0, maximum=10.0, step=0.1, value=default_values["cfg"])
242
- steps = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=default_values["steps"])
243
  with gr.Row():
244
- sample_rate = gr.Slider(label="Sample Rate", minimum=8000, maximum=48000, step=1000, value=default_values["sample_rate"])
245
- fps = gr.Slider(label="FPS", minimum=1, maximum=60, step=1, value=default_values["fps"])
246
- device = gr.Radio(label="Device", choices=["cuda", "cpu"], value=default_values["device"])
247
  generate_button = gr.Button("Generate Video")
248
  with gr.Column():
249
  output_video = gr.Video()
@@ -275,9 +279,15 @@ with gr.Blocks() as demo:
275
  inputs = [uploaded_audio]
276
  )
277
  gr.HTML("""
278
- <a href="https://huggingface.co/spaces/fffiloni/EchoMimic?duplicate=true">
279
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg" alt="Duplicate this Space">
280
- </a>
 
 
 
 
 
 
281
  """)
282
 
283
  def generate_video(uploaded_img, uploaded_audio, width, height, length, seed, facemask_dilation_ratio, facecrop_dilation_ratio, context_frames, context_overlap, cfg, steps, sample_rate, fps, device):
 
35
  local_dir_use_symlinks=False,
36
  )
37
 
38
+ is_shared_ui = True if "fffiloni/EchoMimic" in os.environ['SPACE_ID'] else False
39
+ available_property = False if is_shared_ui else True
40
+ advanced_settings_label = "Advanced Configuration (only for duplicated spaces)" if is_shared_ui else "Advanced Configuration"
41
+
42
  default_values = {
43
  "width": 512,
44
  "height": 512,
 
228
  with gr.Column():
229
  uploaded_img = gr.Image(type="filepath", label="Reference Image")
230
  uploaded_audio = gr.Audio(type="filepath", label="Input Audio")
231
+ with gr.Accordion(label=advanced_settings_label, open=False):
232
  with gr.Row():
233
+ width = gr.Slider(label="Width", minimum=128, maximum=1024, value=default_values["width"], interactive=available_property)
234
+ height = gr.Slider(label="Height", minimum=128, maximum=1024, value=default_values["height"], interactive=available_property)
235
  with gr.Row():
236
+ length = gr.Slider(label="Length", minimum=100, maximum=5000, value=default_values["length"], interactive=available_property)
237
+ seed = gr.Slider(label="Seed", minimum=0, maximum=10000, value=default_values["seed"], interactive=available_property)
238
  with gr.Row():
239
+ facemask_dilation_ratio = gr.Slider(label="Facemask Dilation Ratio", minimum=0.0, maximum=1.0, step=0.01, value=default_values["facemask_dilation_ratio"], interactive=available_property)
240
+ facecrop_dilation_ratio = gr.Slider(label="Facecrop Dilation Ratio", minimum=0.0, maximum=1.0, step=0.01, value=default_values["facecrop_dilation_ratio"], interactive=available_property)
241
  with gr.Row():
242
+ context_frames = gr.Slider(label="Context Frames", minimum=0, maximum=50, step=1, value=default_values["context_frames"], interactive=available_property)
243
+ context_overlap = gr.Slider(label="Context Overlap", minimum=0, maximum=10, step=1, value=default_values["context_overlap"], interactive=available_property)
244
  with gr.Row():
245
+ cfg = gr.Slider(label="CFG", minimum=0.0, maximum=10.0, step=0.1, value=default_values["cfg"], interactive=available_property)
246
+ steps = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=default_values["steps"], interactive=available_property)
247
  with gr.Row():
248
+ sample_rate = gr.Slider(label="Sample Rate", minimum=8000, maximum=48000, step=1000, value=default_values["sample_rate"], interactive=available_property)
249
+ fps = gr.Slider(label="FPS", minimum=1, maximum=60, step=1, value=default_values["fps"], interactive=available_property)
250
+ device = gr.Radio(label="Device", choices=["cuda", "cpu"], value=default_values["device"], interactive=available_property)
251
  generate_button = gr.Button("Generate Video")
252
  with gr.Column():
253
  output_video = gr.Video()
 
279
  inputs = [uploaded_audio]
280
  )
281
  gr.HTML("""
282
+ <hr />
283
+ <div style="display:flex;column-gap:4px;">
284
+ <a href="https://huggingface.co/spaces/fffiloni/EchoMimic?duplicate=true">
285
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg" alt="Duplicate this Space">
286
+ </a>
287
+ <a href="https://huggingface.co/fffiloni">
288
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-xl-dark.svg" alt="Follow me on HF">
289
+ </a>
290
+ </div>
291
  """)
292
 
293
  def generate_video(uploaded_img, uploaded_audio, width, height, length, seed, facemask_dilation_ratio, facecrop_dilation_ratio, context_frames, context_overlap, cfg, steps, sample_rate, fps, device):