shruti9S commited on
Commit
ed4a32f
·
verified ·
1 Parent(s): 5eecbee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -18
app.py CHANGED
@@ -44,20 +44,18 @@ def sadtalker_demo():
44
  <a style='font-size:18px;color: #efefef' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
45
  <a style='font-size:18px;color: #efefef' href='https://github.com/Winfredy/SadTalker'> Github </div>")
46
 
47
-
48
  gr.Markdown("""
49
- <b>You may duplicate the space and upgrade to GPU in settings for better performance and faster inference without waiting in the queue. <a style='display:inline-block' href="https://huggingface.co/spaces/vinthony/SadTalker?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></b> \
50
  <br/><b>Alternatively, try our GitHub <a href=https://github.com/Winfredy/SadTalker> code </a> on your own GPU. </b> <a style='display:inline-block' href="https://github.com/Winfredy/SadTalker"><img src="https://img.shields.io/github/stars/Winfredy/SadTalker?style=social"/></a> \
51
  """)
52
-
53
- with gr.Row().style(equal_height=False):
54
  with gr.Column(variant='panel'):
55
  with gr.Tabs(elem_id="sadtalker_source_image"):
56
  with gr.TabItem('Source image'):
57
  with gr.Row():
58
  source_image = gr.Image(label="Source image", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
59
 
60
-
61
  with gr.Tabs(elem_id="sadtalker_driven_audio"):
62
  with gr.TabItem('Driving Methods'):
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) ")
@@ -84,33 +82,31 @@ def sadtalker_demo():
84
  with gr.Column(variant='panel'):
85
  with gr.Tabs(elem_id="sadtalker_checkbox"):
86
  with gr.TabItem('Settings'):
87
- gr.Markdown("need help? please visit our [[best practice page](https://github.com/OpenTalker/SadTalker/blob/main/docs/best_practice.md)] for more detials")
88
  with gr.Column(variant='panel'):
89
  # width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
90
  # height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
91
  with gr.Row():
92
  pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0) #
93
- exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1) #
94
- blink_every = gr.Checkbox(label="use eye blink", value=True)
95
 
96
  with gr.Row():
97
- size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?") #
98
- preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='preprocess', info="How to handle input image?")
99
 
100
  with gr.Row():
101
  is_still_mode = gr.Checkbox(label="Still Mode (fewer head motion, works with preprocess `full`)")
102
- facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?")
103
 
104
  with gr.Row():
105
- batch_size = gr.Slider(label="batch size in generation", step=1, maximum=10, value=1)
106
  enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
107
 
108
  submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
109
-
110
- with gr.Tabs(elem_id="sadtalker_genearted"):
111
- gen_video = gr.Video(label="Generated video", format="mp4").style(width=256)
112
 
113
-
 
114
 
115
  submit.click(
116
  fn=sad_talker.test,
@@ -219,5 +215,3 @@ if __name__ == "__main__":
219
  demo = sadtalker_demo()
220
  demo.queue(max_size=10, api_open=True)
221
  demo.launch(debug=True)
222
-
223
-
 
44
  <a style='font-size:18px;color: #efefef' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
45
  <a style='font-size:18px;color: #efefef' href='https://github.com/Winfredy/SadTalker'> Github </div>")
46
 
 
47
  gr.Markdown("""
48
+ <b>You may duplicate the space and upgrade to GPU in settings for better performance and faster inference and without waiting in the queue. <a style='display:inline-block' href="https://huggingface.co/spaces/vinthony/SadTalker?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></b> \
49
  <br/><b>Alternatively, try our GitHub <a href=https://github.com/Winfredy/SadTalker> code </a> on your own GPU. </b> <a style='display:inline-block' href="https://github.com/Winfredy/SadTalker"><img src="https://img.shields.io/github/stars/Winfredy/SadTalker?style=social"/></a> \
50
  """)
51
+
52
+ with gr.Row():
53
  with gr.Column(variant='panel'):
54
  with gr.Tabs(elem_id="sadtalker_source_image"):
55
  with gr.TabItem('Source image'):
56
  with gr.Row():
57
  source_image = gr.Image(label="Source image", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
58
 
 
59
  with gr.Tabs(elem_id="sadtalker_driven_audio"):
60
  with gr.TabItem('Driving Methods'):
61
  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) ")
 
82
  with gr.Column(variant='panel'):
83
  with gr.Tabs(elem_id="sadtalker_checkbox"):
84
  with gr.TabItem('Settings'):
85
+ gr.Markdown("need help? please visit our [[best practice page](https://github.com/OpenTalker/SadTalker/blob/main/docs/best_practice.md)] for more details")
86
  with gr.Column(variant='panel'):
87
  # width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
88
  # height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
89
  with gr.Row():
90
  pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0) #
91
+ exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="Expression scale", value=1) #
92
+ blink_every = gr.Checkbox(label="Use eye blink", value=True)
93
 
94
  with gr.Row():
95
+ size_of_image = gr.Radio([256, 512], value=256, label='Face model resolution', info="Use 256/512 model?") #
96
+ preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='Preprocess', info="How to handle input image?")
97
 
98
  with gr.Row():
99
  is_still_mode = gr.Checkbox(label="Still Mode (fewer head motion, works with preprocess `full`)")
100
+ facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='Face render', info="Which face render?")
101
 
102
  with gr.Row():
103
+ batch_size = gr.Slider(label="Batch size in generation", step=1, maximum=10, value=1)
104
  enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
105
 
106
  submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
 
 
 
107
 
108
+ with gr.Tabs(elem_id="sadtalker_generated"):
109
+ gen_video = gr.Video(label="Generated video", format="mp4").style(width=256)
110
 
111
  submit.click(
112
  fn=sad_talker.test,
 
215
  demo = sadtalker_demo()
216
  demo.queue(max_size=10, api_open=True)
217
  demo.launch(debug=True)