|
import requests |
|
import gradio as gr |
|
import base64 |
|
|
|
def synthesize(key, sentence, speaker): |
|
headers = { |
|
'Authorization': 'Bearer {}'.format(key), |
|
'Content-Type': 'application/json', |
|
} |
|
|
|
json_data = { |
|
'text': sentence, |
|
'speaker': speaker, |
|
} |
|
|
|
response = requests.post('https://rjmopratfrdjgmfmaios.functions.supabase.co/rime-tts', headers=headers, json=json_data) |
|
audioContent = response.json()['audioContent'] |
|
decode_string = base64.b64decode(audioContent) |
|
with open('tmp.wav', 'wb') as fp: |
|
fp.write(decode_string) |
|
return 'tmp.wav' |
|
|
|
iface = gr.Interface(fn=synthesize, inputs=["text", "text","text"], outputs=gr.Audio()) |
|
iface.launch() |