C4G-HKUST commited on
Commit
7b1f748
·
1 Parent(s): b197409

Remove generation_time_display component from examples

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -748,30 +748,23 @@ def run_graio_demo(args):
748
  *Note: Generation time (tested on NVIDIA H200 GPU with 40 denoising steps) may vary depending on GPU specifications and system load.*
749
  """)
750
 
751
- # 文本组件用于在 Examples 表格中显示生成耗时(放在第二列)
752
- generation_time_display = gr.Textbox(label="Generation Time (H200 GPU, 40 steps)", 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
- # 确保 gen_time 始终有有效值,避免缓存读取时的 JSON 解析错误
759
- if not gen_time or gen_time.strip() == "":
760
- # 如果 gen_time 为空,尝试从示例数据中恢复(这里作为备用,通常不会触发)
761
- gen_time = "N/A"
762
  return (
763
  image, prompt, person_num, audio_mode,
764
- audio1, audio2, audio3, gen_time
765
  )
766
 
767
  examples_component = gr.Examples(
768
  examples = [
769
- ["./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],
770
- ["./input_example/images/2p-1.png", "~8 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],
771
- ["./input_example/images/2p-2.png", "~11 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],
772
  ],
773
- inputs = [img2vid_image, generation_time_display, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3],
774
- outputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3, generation_time_display],
775
  fn=handle_example_select,
776
  cache_examples=False, # 禁用缓存以避免 JSON 解码错误
777
  )
 
748
  *Note: Generation time (tested on NVIDIA H200 GPU with 40 denoising steps) may vary depending on GPU specifications and system load.*
749
  """)
750
 
751
+ # 创建一个函数来处理 examples 选择
752
+ def handle_example_select(image, prompt, person_num, audio_mode, audio1, audio2, audio3):
 
 
 
753
  # 三个音频输入框始终可见,只返回值,不改变可见性
754
  # 读取时根据 person_num_selector 只读取前 n 个音频
 
 
 
 
755
  return (
756
  image, prompt, person_num, audio_mode,
757
+ audio1, audio2, audio3
758
  )
759
 
760
  examples_component = gr.Examples(
761
  examples = [
762
+ ["./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],
763
+ ["./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],
764
+ ["./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],
765
  ],
766
+ inputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3],
767
+ outputs = [img2vid_image, img2vid_prompt, person_num_selector, audio_mode_selector, img2vid_audio_1, img2vid_audio_2, img2vid_audio_3],
768
  fn=handle_example_select,
769
  cache_examples=False, # 禁用缓存以避免 JSON 解码错误
770
  )