C4G-HKUST commited on
Commit
e9633ab
·
1 Parent(s): b505615

Fix examples: move generation time to second column and fix list index out of range error

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -748,27 +748,28 @@ def run_graio_demo(args):
748
  *Note: Generation time (tested on NVIDIA H200 GPU) may vary depending on GPU specifications and system load.*
749
  """)
750
 
751
- # 隐藏的文本组件用于在 Examples 表格中显示生成耗时
752
  generation_time_display = gr.Textbox(label="Generation Time (H200 GPU)", visible=True, interactive=False)
753
 
754
  # 创建一个函数来处理 examples 选择,同时更新音频输入框的可见性
755
- def handle_example_select(image, prompt, person_num, audio_mode, audio1, audio2, audio3, gen_time):
756
  # 三个音频输入框始终可见,只返回值,不改变可见性
757
  # 读取时根据 person_num_selector 只读取前 n 个音频
 
758
  return (
759
  image, prompt, person_num, audio_mode,
760
- audio1, audio2, audio3, gen_time
761
  )
762
 
763
  examples_component = gr.Examples(
764
  examples = [
765
- ["./input_example/images/1p-0.png", "The man stands in the dusty western street, backlit by the setting sun, and his determined gaze speaks of a rugged spirit.", "1 Person", "pad", "./input_example/audios/1p-0.wav", None, None, "~4 minutes"],
766
- ["./input_example/images/2p-0.png", "The two people are talking to each other.", "2 Persons", "pad", "./input_example/audios/2p-0-left.wav", "./input_example/audios/2p-0-right.wav", None, "~10 minutes"],
767
- ["./input_example/images/2p-1.png", "In a casual, intimate setting, a man and a woman are engaged in a heartfelt conversation inside a car. The man, sporting a denim jacket over a blue shirt, sits attentively with a seatbelt fastened, his gaze fixed on the woman beside him. The woman, wearing a black tank top and a denim jacket draped over her shoulders, smiles warmly, her eyes reflecting genuine interest and connection. The car's interior, with its beige seats and simple design, provides a backdrop that emphasizes their interaction. The scene captures a moment of shared understanding and connection, set against the soft, diffused light of an overcast day. A medium shot from a slightly angled perspective, focusing on their expressions and body language.", "2 Persons", "pad", "./input_example/audios/2p-1-left.wav", "./input_example/audios/2p-1-right.wav", None, "~6 minutes"],
768
- ["./input_example/images/2p-2.png", "In a cozy recording studio, a man and a woman are singing together. The man, with tousled brown hair, stands to the left, wearing a light green button-down shirt. His gaze is directed towards the woman, who is smiling warmly. She, with wavy dark hair, is dressed in a black floral dress and stands to the right, her eyes closed in enjoyment. Between them is a professional microphone, capturing their harmonious voices. The background features wooden panels and various audio equipment, creating an intimate and focused atmosphere. The lighting is soft and warm, highlighting their expressions and the intimate setting. A medium shot captures their interaction closely.", "2 Persons", "pad", "./input_example/audios/2p-2-left.wav", "./input_example/audios/2p-2-right.wav", None, "~8 minutes"],
769
  ],
770
- inputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3, generation_time_display],
771
- outputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3, generation_time_display],
772
  fn=handle_example_select,
773
  )
774
 
 
748
  *Note: Generation time (tested on NVIDIA H200 GPU) may vary depending on GPU specifications and system load.*
749
  """)
750
 
751
+ # 文本组件用于在 Examples 表格中显示生成耗时(放在第二列)
752
  generation_time_display = gr.Textbox(label="Generation Time (H200 GPU)", visible=True, interactive=False)
753
 
754
  # 创建一个函数来处理 examples 选择,同时更新音频输入框的可见性
755
+ def handle_example_select(image, gen_time, prompt, person_num, audio_mode, audio1, audio2, audio3):
756
  # 三个音频输入框始终可见,只返回值,不改变可见性
757
  # 读取时根据 person_num_selector 只读取前 n 个音频
758
+ # generation_time_display 不需要更新,所以不返回
759
  return (
760
  image, prompt, person_num, audio_mode,
761
+ audio1, audio2, audio3
762
  )
763
 
764
  examples_component = gr.Examples(
765
  examples = [
766
+ ["./input_example/images/1p-0.png", "~4 minutes", "The man stands in the dusty western street, backlit by the setting sun, and his determined gaze speaks of a rugged spirit.", "1 Person", "pad", "./input_example/audios/1p-0.wav", None, None],
767
+ ["./input_example/images/2p-0.png", "~10 minutes", "The two people are talking to each other.", "2 Persons", "pad", "./input_example/audios/2p-0-left.wav", "./input_example/audios/2p-0-right.wav", None],
768
+ ["./input_example/images/2p-1.png", "~6 minutes", "In a casual, intimate setting, a man and a woman are engaged in a heartfelt conversation inside a car. The man, sporting a denim jacket over a blue shirt, sits attentively with a seatbelt fastened, his gaze fixed on the woman beside him. The woman, wearing a black tank top and a denim jacket draped over her shoulders, smiles warmly, her eyes reflecting genuine interest and connection. The car's interior, with its beige seats and simple design, provides a backdrop that emphasizes their interaction. The scene captures a moment of shared understanding and connection, set against the soft, diffused light of an overcast day. A medium shot from a slightly angled perspective, focusing on their expressions and body language.", "2 Persons", "pad", "./input_example/audios/2p-1-left.wav", "./input_example/audios/2p-1-right.wav", None],
769
+ ["./input_example/images/2p-2.png", "~8 minutes", "In a cozy recording studio, a man and a woman are singing together. The man, with tousled brown hair, stands to the left, wearing a light green button-down shirt. His gaze is directed towards the woman, who is smiling warmly. She, with wavy dark hair, is dressed in a black floral dress and stands to the right, her eyes closed in enjoyment. Between them is a professional microphone, capturing their harmonious voices. The background features wooden panels and various audio equipment, creating an intimate and focused atmosphere. The lighting is soft and warm, highlighting their expressions and the intimate setting. A medium shot captures their interaction closely.", "2 Persons", "pad", "./input_example/audios/2p-2-left.wav", "./input_example/audios/2p-2-right.wav", None],
770
  ],
771
+ inputs = [img2vid_image, generation_time_display, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3],
772
+ outputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3],
773
  fn=handle_example_select,
774
  )
775