Hev832 commited on
Commit
5bc4b4a
1 Parent(s): 2642d96

better ui's

Browse files

preview:


![Screenshot_2024-08-30-20-58-04-23_40deb401b9ffe8e1df2f1cc5ba480b12.jpg](https://cdn-uploads.huggingface.co/production/uploads/6456271e4095c967f9a93ec1/hmQEL2kDLtEUjOKvEJInF.jpeg)

Files changed (1) hide show
  1. app.py +26 -35
app.py CHANGED
@@ -39,7 +39,7 @@ def sadtalker_demo():
39
  sad_talker = SadTalker(lazy_load=True)
40
  # tts_talker = TTSTalker()
41
 
42
- with gr.Blocks(analytics_enabled=False) as sadtalker_interface:
43
  gr.Markdown("<div align='center'> <h2> 😭 SadTalker: Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation (CVPR 2023) </span> </h2> \
44
  <a style='font-size:18px;color: #efefef' href='https://arxiv.org/abs/2211.12194'>Arxiv</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
45
  <a style='font-size:18px;color: #efefef' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
@@ -59,57 +59,48 @@ def sadtalker_demo():
59
  source_image = gr.Image(label="Source image", type="filepath", elem_id="img2img_image")
60
 
61
 
62
- with gr.Tabs(elem_id="sadtalker_driven_audio"):
63
- with gr.TabItem('Driving Methods'):
64
  gr.Markdown("Possible driving combinations: <br> 1. Audio only 2. Audio/IDLE Mode + Ref Video(pose, blink, pose+blink) 3. IDLE Mode only 4. Ref Video only (all) ")
65
-
66
  with gr.Row():
67
  driven_audio = gr.Audio(label="Input audio", type="filepath")
68
  driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", type="filepath", visible=False)
69
-
70
- with gr.Column():
71
- use_idle_mode = gr.Checkbox(label="Use Idle Animation")
72
- length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.")
73
- use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
74
-
75
  with gr.Row():
76
- ref_video = gr.Video(label="Reference Video", elem_id="vidref")
77
 
78
- with gr.Column():
79
- use_ref_video = gr.Checkbox(label="Use Reference Video")
80
- ref_info = gr.Radio(['pose', 'blink','pose+blink', 'all'], value='pose', label='Reference Video',info="How to borrow from reference Video?((fully transfer, aka, video driving mode))")
81
 
82
- ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
 
83
 
84
 
85
- with gr.Column(variant='panel'):
86
- with gr.Tabs(elem_id="sadtalker_checkbox"):
87
- with gr.TabItem('Settings'):
88
  gr.Markdown("need help? please visit our [[best practice page](https://github.com/OpenTalker/SadTalker/blob/main/docs/best_practice.md)] for more detials")
89
  with gr.Column(variant='panel'):
90
- # width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
91
- # height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
92
  with gr.Row():
93
  pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0) #
94
  exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1) #
95
  blink_every = gr.Checkbox(label="use eye blink", value=True)
96
-
97
- with gr.Row():
98
- size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?") #
99
- preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='preprocess', info="How to handle input image?")
100
-
101
- with gr.Row():
102
- is_still_mode = gr.Checkbox(label="Still Mode (fewer head motion, works with preprocess `full`)")
103
- facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?")
104
-
105
- with gr.Row():
106
- batch_size = gr.Slider(label="batch size in generation", step=1, maximum=10, value=1)
107
- enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
108
 
109
- submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
110
 
111
  with gr.Tabs(elem_id="sadtalker_genearted"):
112
- gen_video = gr.Video(label="Generated video", format="mp4")
113
 
114
 
115
 
@@ -222,4 +213,4 @@ if __name__ == "__main__":
222
  demo.queue()
223
  demo.launch()
224
  #demo.queue(max_size=10, api_open=True)
225
- #demo.launch(debug=True)
 
39
  sad_talker = SadTalker(lazy_load=True)
40
  # tts_talker = TTSTalker()
41
 
42
+ with gr.Blocks(analytics_enabled=False, theme="Hev832/Applio") as sadtalker_interface:
43
  gr.Markdown("<div align='center'> <h2> 😭 SadTalker: Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation (CVPR 2023) </span> </h2> \
44
  <a style='font-size:18px;color: #efefef' href='https://arxiv.org/abs/2211.12194'>Arxiv</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
45
  <a style='font-size:18px;color: #efefef' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 
59
  source_image = gr.Image(label="Source image", type="filepath", elem_id="img2img_image")
60
 
61
 
62
+ with gr.TabItem('Driving Methods',elem_id="sadtalker_driven_audio"):
 
63
  gr.Markdown("Possible driving combinations: <br> 1. Audio only 2. Audio/IDLE Mode + Ref Video(pose, blink, pose+blink) 3. IDLE Mode only 4. Ref Video only (all) ")
 
64
  with gr.Row():
65
  driven_audio = gr.Audio(label="Input audio", type="filepath")
66
  driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", type="filepath", visible=False)
67
+ with gr.Column():
68
+ use_idle_mode = gr.Checkbox(label="Use Idle Animation")
69
+ length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.")
70
+ use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
 
 
71
  with gr.Row():
72
+ ref_video = gr.Video(label="Reference Video", elem_id="vidref")
73
 
74
+ with gr.Column():
75
+ use_ref_video = gr.Checkbox(label="Use Reference Video")
76
+ ref_info = gr.Radio(['pose', 'blink','pose+blink', 'all'], value='pose', label='Reference Video',info="How to borrow from reference Video?((fully transfer, aka, video driving mode))")
77
 
78
+
79
+ ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
80
 
81
 
82
+
83
+ with gr.TabItem('Settings',elem_id="sadtalker_checkbox"):
 
84
  gr.Markdown("need help? please visit our [[best practice page](https://github.com/OpenTalker/SadTalker/blob/main/docs/best_practice.md)] for more detials")
85
  with gr.Column(variant='panel'):
 
 
86
  with gr.Row():
87
  pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0) #
88
  exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1) #
89
  blink_every = gr.Checkbox(label="use eye blink", value=True)
90
+ with gr.Row():
91
+ size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?") #
92
+ preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='preprocess', info="How to handle input image?")
93
+ with gr.Row():
94
+ is_still_mode = gr.Checkbox(label="Still Mode (fewer head motion, works with preprocess `full`)")
95
+ facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?")
96
+ with gr.Row():
97
+ batch_size = gr.Slider(label="batch size in generation", step=1, maximum=10, value=1)
98
+ enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
 
 
 
99
 
100
+ submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
101
 
102
  with gr.Tabs(elem_id="sadtalker_genearted"):
103
+ gen_video = gr.Video(label="Generated video", format="mp4")
104
 
105
 
106
 
 
213
  demo.queue()
214
  demo.launch()
215
  #demo.queue(max_size=10, api_open=True)
216
+ #demo.launch(debug=True)