Spaces:
Sleeping
Sleeping
stevenhillis
commited on
Commit
•
0270007
1
Parent(s):
f3e678b
prompt audio as list for files request
Browse files
app.py
CHANGED
@@ -14,9 +14,9 @@ token_str = os.environ['DG_TOKEN']
|
|
14 |
def tts_fn(text, prompt_audio, prompt_seconds, inference_steps, inference_temperature, pitch_steps):
|
15 |
texts = [text]
|
16 |
sr = prompt_audio[0]
|
17 |
-
prompt_audio = prompt_audio[1].astype(np.float32, order='C') / 32768.0
|
18 |
params={'synthesize': 'true', 'pitch_steps': int(pitch_steps), 'soundstorm_steps': inference_steps, 'temperature': inference_temperature, 'prompt_seconds': prompt_seconds}
|
19 |
-
files=[('texts', ('texts', json.dumps(texts), 'application/json')), ('prompt_audio', ('prompt_audio', json.dumps(prompt_audio), 'application/json'))]
|
20 |
response = requests.post(base_url, files=files, params=params, headers={'Authorization': f'Token {token_str}'}).json()
|
21 |
try:
|
22 |
sample_rate = int(response['results'][0]['sample_rate'])
|
|
|
14 |
def tts_fn(text, prompt_audio, prompt_seconds, inference_steps, inference_temperature, pitch_steps):
|
15 |
texts = [text]
|
16 |
sr = prompt_audio[0]
|
17 |
+
prompt_audio = np.reshape(prompt_audio[1], (1, 1, -1)).astype(np.float32, order='C') / 32768.0
|
18 |
params={'synthesize': 'true', 'pitch_steps': int(pitch_steps), 'soundstorm_steps': inference_steps, 'temperature': inference_temperature, 'prompt_seconds': prompt_seconds}
|
19 |
+
files=[('texts', ('texts', json.dumps(texts), 'application/json')), ('prompt_audio', ('prompt_audio', json.dumps(prompt_audio.tolist()), 'application/json'))]
|
20 |
response = requests.post(base_url, files=files, params=params, headers={'Authorization': f'Token {token_str}'}).json()
|
21 |
try:
|
22 |
sample_rate = int(response['results'][0]['sample_rate'])
|