File size: 506 Bytes
f2d8fa0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr

whisper_to_gpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
tts = gr.Interface.load(name="spaces/StevenLimcorn/fastspeech2-TTS")

def infer(audio):
    gpt_response = whisper_to_gpt(audio, "translate", fn_index=1)
    audio_response = tts(gpt_response, "Fastspeech2 + Melgan", fn_index=0)
    return audio_response

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

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