yerang commited on
Commit
3b6cc24
·
verified ·
1 Parent(s): 8114b34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -16
app.py CHANGED
@@ -51,41 +51,52 @@ print("LD_LIBRARY_PATH:", os.environ['LD_LIBRARY_PATH'])
51
 
52
  from stf_utils import STFPipeline
53
 
54
- stf_pipeline = STFPipeline()
55
- audio_path="assets/examples/driving/test_aud.mp3"
56
- #audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
 
 
57
 
58
 
59
  @spaces.GPU()
60
- def gpu_wrapped_stf_pipeline_execute(audio_path):
 
 
 
 
 
61
  return stf_pipeline.execute(audio_path)
62
 
63
 
64
  ###### 테스트중 ######
65
 
66
 
67
- stf_pipeline = STFPipeline()
68
- driving_video_path=gr.Video()
69
 
70
  # set tyro theme
71
  tyro.extras.set_accent_color("bright_cyan")
72
  args = tyro.cli(ArgumentConfig)
 
 
 
 
 
 
 
73
 
74
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
75
  with gr.Row():
76
  #audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
77
  input_audio = gr.Audio(label="Upload or Record an audio", type="filepath")
78
- stf_button = gr.Button("stf test", variant="primary")
 
79
  stf_button.click(
80
- fn=gpu_wrapped_stf_pipeline_execute,
81
- inputs=[
82
- input_audio
83
- ],
84
- outputs=[driving_video_path]
85
- )
86
- with gr.Row():
87
- checkbox_female = gr.Checkbox(label="Female video", value=True) # 디폴트 체크
88
- checkbox_male = gr.Checkbox(label="Male video")
89
  with gr.Row():
90
  driving_video_path.render()
91
 
 
51
 
52
  from stf_utils import STFPipeline
53
 
54
+
55
+
56
+
57
+
58
+
59
 
60
 
61
  @spaces.GPU()
62
+ def gpu_wrapped_stf_pipeline_execute(audio_path, video_type):
63
+ if video_type == "Female video":
64
+ stf_pipeline = stf_pipeline_female
65
+ else:
66
+ stf_pipeline = stf_pipeline_male
67
+
68
  return stf_pipeline.execute(audio_path)
69
 
70
 
71
  ###### 테스트중 ######
72
 
73
 
 
 
74
 
75
  # set tyro theme
76
  tyro.extras.set_accent_color("bright_cyan")
77
  args = tyro.cli(ArgumentConfig)
78
+ driving_video_path=gr.Video()
79
+ stf_pipeline_female = STFPipeline()
80
+ stf_pipeline_male = STFPipeline(
81
+ template_video_path="TEMP/Cam2_2309071202_0012_Natural_Looped.mp4",
82
+ config_path="TEMP/front_config_v3.json",
83
+ checkpoint_path="TEMP/0157.pth",
84
+ )
85
 
86
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
87
  with gr.Row():
88
  #audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
89
  input_audio = gr.Audio(label="Upload or Record an audio", type="filepath")
90
+ stf_button = gr.Button("Audio to Video Generation", variant="primary")
91
+ video_type = gr.Radio(choices=["Female video", "Male video"], label="Select video type", value="Female video")
92
  stf_button.click(
93
+ fn=gpu_wrapped_stf_pipeline_execute,
94
+ inputs=[
95
+ input_audio
96
+ ],
97
+ outputs=[driving_video_path]
98
+ )
99
+
 
 
100
  with gr.Row():
101
  driving_video_path.render()
102