lazhrach commited on
Commit
bd79dbb
1 Parent(s): 83cb595

Remove 'checkpoints' directory from .gitignore

Browse files
Files changed (1) hide show
  1. app.py +26 -26
app.py CHANGED
@@ -49,8 +49,8 @@ def ref_video_fn(path_of_ref_video):
49
  return gr.update(value=False)
50
 
51
  def download_model():
52
- REPO_ID = 'vinthony/SadTalker-V002rc'
53
- snapshot_download(REPO_ID)
54
 
55
  def sadtalker_demo():
56
 
@@ -62,21 +62,21 @@ def sadtalker_demo():
62
  with gr.Row():
63
  with gr.Column(variant='panel'):
64
  with gr.Tabs(elem_id="sadtalker_source_image"):
65
- with gr.TabItem('Source image'):
66
  with gr.Row():
67
- source_image = gr.Image(label="Source image", source="upload", type="filepath", elem_id="img2img_image")
68
 
69
 
70
  with gr.Tabs(elem_id="sadtalker_driven_audio"):
71
- with gr.TabItem('Driving Methods'):
72
  with gr.Row():
73
- model_choice = gr.Dropdown(choices=list(models.keys()), value="TeraTTS/natasha-g2p-vits", label="Choose TTS model")
 
 
74
  with gr.Row():
75
- length_scale = gr.Slider(minimum=0.1, maximum=2.0, label="Length scale (increase length of sound) Default: 1.2", value=1.2)
76
  with gr.Row():
77
- input_text = gr.Textbox(label="Enter text")
78
- with gr.Row():
79
- driven_audio = gr.Audio(label="Input audio", source="upload", type="filepath")
80
  driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", source="upload", type="filepath", visible=False)
81
 
82
  with gr.Column(visible=False):
@@ -84,44 +84,44 @@ def sadtalker_demo():
84
  length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.")
85
  use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
86
  with gr.Row():
87
- play_button = gr.Button('Text To Speech', variant='primary')
88
  play_button.click(
89
  fn=text_to_speech, inputs=[model_choice, length_scale, input_text], outputs=[driven_audio]
90
  )
91
  with gr.Row():
92
- ref_video = gr.Video(label="Reference Video", source="upload", type="filepath", elem_id="vidref")
93
 
94
  with gr.Column():
95
- use_ref_video = gr.Checkbox(label="Use Reference Video")
96
- 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))")
97
 
98
  ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
99
 
100
  with gr.Column(variant='panel'):
101
  with gr.Tabs(elem_id="sadtalker_checkbox"):
102
- with gr.TabItem('Settings'):
103
  with gr.Column(variant='panel'):
104
  with gr.Row():
105
- pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0) #
106
- exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1) #
107
- blink_every = gr.Checkbox(label="use eye blink", value=True)
108
 
109
  with gr.Row():
110
- size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?") #
111
- preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='preprocess', info="How to handle input image?")
112
 
113
  with gr.Row():
114
- is_still_mode = gr.Checkbox(label="Still Mode (fewer head motion, works with preprocess `full`)")
115
- facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?")
116
 
117
  with gr.Row():
118
- batch_size = gr.Slider(label="batch size in generation", step=1, maximum=10, value=1)
119
- enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
120
 
121
- submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
122
 
123
  with gr.Tabs(elem_id="sadtalker_genearted"):
124
- gen_video = gr.Video(label="Generated video", format="mp4")
125
 
126
  submit.click(
127
  fn=sad_talker.test,
 
49
  return gr.update(value=False)
50
 
51
  def download_model():
52
+ REPO_ID = 'vinthony/SadTalker-V002rc'
53
+ snapshot_download(repo_id=REPO_ID, local_dir='./checkpoints', local_dir_use_symlinks=True)
54
 
55
  def sadtalker_demo():
56
 
 
62
  with gr.Row():
63
  with gr.Column(variant='panel'):
64
  with gr.Tabs(elem_id="sadtalker_source_image"):
65
+ with gr.TabItem('Исходное изображение'):
66
  with gr.Row():
67
+ source_image = gr.Image(label="Аватарка", source="upload", type="filepath", elem_id="img2img_image")
68
 
69
 
70
  with gr.Tabs(elem_id="sadtalker_driven_audio"):
71
+ with gr.TabItem('Генерация или загрузка аудио'):
72
  with gr.Row():
73
+ model_choice = gr.Dropdown(choices=list(models.keys()), value="TeraTTS/natasha-g2p-vits", label="Выберите модель TTS для синтеза речи:")
74
+ with gr.Row(visible=False):
75
+ length_scale = gr.Slider(minimum=0.1, maximum=2.0, label="Length scale (увеличить длину звучания) По умолчанию: 1.2", value=1.2)
76
  with gr.Row():
77
+ input_text = gr.Textbox(label="Введите текст для синтеза речи:")
78
  with gr.Row():
79
+ driven_audio = gr.Audio(label="Аудиофайл", source="upload", type="filepath")
 
 
80
  driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", source="upload", type="filepath", visible=False)
81
 
82
  with gr.Column(visible=False):
 
84
  length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.")
85
  use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
86
  with gr.Row():
87
+ play_button = gr.Button('Синтез речи', variant='primary')
88
  play_button.click(
89
  fn=text_to_speech, inputs=[model_choice, length_scale, input_text], outputs=[driven_audio]
90
  )
91
  with gr.Row():
92
+ ref_video = gr.Video(label="Видео для генерации", source="upload", type="filepath", elem_id="vidref")
93
 
94
  with gr.Column():
95
+ use_ref_video = gr.Checkbox(label="Использовать видео для генерации")
96
+ ref_info = gr.Radio(['pose', 'blink','pose+blink', 'all'], value='pose', label='Видео для эталона',info="Как использовать эталонное видео?((video driving mode))")
97
 
98
  ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
99
 
100
  with gr.Column(variant='panel'):
101
  with gr.Tabs(elem_id="sadtalker_checkbox"):
102
+ with gr.TabItem('Настройки генерации видео'):
103
  with gr.Column(variant='panel'):
104
  with gr.Row():
105
+ pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Стиль", value=0) #
106
+ exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="Степень выразительности", value=1) #
107
+ blink_every = gr.Checkbox(label="Моргание", value=True)
108
 
109
  with gr.Row():
110
+ size_of_image = gr.Radio([256, 512], value=256, label='Разрешение модели лица', info="256/512?") #
111
+ preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='Предварительная обработка', info="Как обрабатывать входное изображение?")
112
 
113
  with gr.Row():
114
+ is_still_mode = gr.Checkbox(label="Режим неподвижности (меньше движений головы, работает с full режимом)")
115
+ facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='Рендер лица', info="Какой использовать?")
116
 
117
  with gr.Row():
118
+ batch_size = gr.Slider(label="Размер пакета при генерации", step=1, maximum=10, value=1)
119
+ enhancer = gr.Checkbox(label="GFPGAN как пост-обработчик лица")
120
 
121
+ submit = gr.Button('Генерировать', elem_id="sadtalker_generate", variant='primary')
122
 
123
  with gr.Tabs(elem_id="sadtalker_genearted"):
124
+ gen_video = gr.Video(label="Сгенерированное изображение", format="mp4")
125
 
126
  submit.click(
127
  fn=sad_talker.test,