Skip to content

Commit

Permalink
update path with join_worker_data_dir (modelscope#363)
Browse files Browse the repository at this point in the history
* add sadtalker to a new tab

* update the gfpgan-patch name

* update README and def get_previous_image_result

* update gr.Markdown

* update video save dir

* add tts

* update readme and requirement

* update edge-tts requirement

* update path with join_worker_data_dir
  • Loading branch information
wwdok authored Nov 6, 2023
1 parent 47a7e50 commit 7d33abf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,10 @@ def get_previous_image_result(uuid):
image_results_old = glob(os.path.join(save_dir_old, '**/single/*.png'), recursive=True)
save_dir = os.path.join('.', uuid, 'inference_result')
image_results = glob(os.path.join(save_dir, '**/single/*.png'), recursive=True)
# print(f"==>> image_results: {image_results}")
return image_results_old+image_results
save_dir_new = join_worker_data_dir(uuid, 'inference_result')
image_results_new = glob(os.path.join(save_dir_new, '**/single/*.png'), recursive=True)

return image_results_old + image_results + image_results_new


def launch_pipeline_talkinghead(uuid, source_image, driven_audio, preprocess='crop',
Expand Down Expand Up @@ -1274,7 +1276,7 @@ def inference_talkinghead():
image_results = gr.Gallery(value=image_result_list, label='之前合成的图片(previous generated images)', allow_preview=False, columns=6, height=250)
update_button = gr.Button('刷新之前合成的图片(Refresh previous generated images)')
driven_audio = gr.Audio(label="驱动音频(driven audio)", source="upload", type="filepath")
input_text = gr.Textbox(label="用文本生成音频(Generating audio from text)", lines=1, value="大家好,欢迎大家使用阿里达摩院开源的facechain项目!")
input_text = gr.Textbox(label="用文本生成音频(Generating audio from text)", lines=1, value="大家好,欢迎使用魔搭开源的facechain项目!")
speaker = gr.Dropdown(choices=list(tts_speakers_map.keys()), value="普通话(中国大陆)-Xiaoxiao-女", label="请根据输入文本选择对应的语言和说话人(Select speaker according the language of input text)")
tts = gr.Button('生成音频(Generate audio)')
tts.click(fn=text_to_speech_edge, inputs=[input_text, speaker], outputs=[driven_audio])
Expand Down
4 changes: 3 additions & 1 deletion facechain/inference_talkinghead.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile
from modelscope.pipelines import pipeline
from facechain.constants import tts_speakers_map
from facechain.utils import join_worker_data_dir
try:
import edge_tts
except ImportError:
Expand All @@ -19,7 +20,8 @@ def __init__(self, uuid):
uuid = 'qw'

# self.save_dir = os.path.join('/tmp', uuid, 'sythesized_video') # deprecated
self.save_dir = os.path.join('.', uuid, 'sythesized_video')
# self.save_dir = os.path.join('.', uuid, 'sythesized_video') # deprecated
self.save_dir = join_worker_data_dir(uuid, 'sythesized_video')

def __call__(self, *args, **kwargs) -> Any:
# two required arguments
Expand Down

0 comments on commit 7d33abf

Please sign in to comment.