File size: 829 Bytes
f2d8fa0
346d904
701d40f
 
f2d8fa0
 
38a2466
f2d8fa0
 
bda46f5
346d904
bda46f5
346d904
38a2466
346d904
f2d8fa0
 
346d904
f2d8fa0
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from PIL import Image
import os
token = os.environ.get('HF_TOKEN')
whisper_to_gpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
tts = gr.Interface.load(name="spaces/StevenLimcorn/fastspeech2-TTS")
talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_key=token)

def infer(audio):
    gpt_response = whisper_to_gpt(audio, "translate", fn_index=0)
    #print(gpt_response)
    audio_response = tts(gpt_response[1], "Fastspeech2 + Melgan", fn_index=0)
    image = Image.open(r"wise_woman_portrait.png")
    portrait = talking_face(image, audio_response, fn_index=0)
    return audio_response, portrait

inputs = gr.Audio(source="microphone",type="filepath")
outputs = [gr.Audio(), gr.Video()]

demo = gr.Interface(fn=infer, inputs=inputs, outputs=outputs)
demo.launch()