Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 002934c

Browse files
committed
add missing voice preset in the script to audio flow
1 parent d6d74c3 commit 002934c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/guides/python/ai-podcast-part-2.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ audio_job = gen_audio_job.allow("submit")
124124
async def do_gen_script(ctx: JobContext):
125125
prompt = ctx.req.data["prompt"]
126126
title = ctx.req.data["title"]
127+
preset = ctx.req.data["preset"]
127128

128129
print('generating script')
129130

@@ -155,6 +156,7 @@ async def do_gen_script(ctx: JobContext):
155156
await audio_job.submit({
156157
"text": text_response,
157158
"file": title,
159+
"preset": preset,
158160
})
159161

160162
Nitric.run()
@@ -298,18 +300,19 @@ async def submit_audio(ctx: HttpContext):
298300

299301
await generate_audio.submit({"file": name, "model_id": model_id, "text": body.decode('utf-8'), "preset": preset})
300302

301-
# !diff(1:12) +
303+
# !diff(1:13) +
302304
# Generate a full podcast from script to audio
303305
@main_api.post("/podcast/:title")
304306
async def submit_script(ctx: HttpContext):
305307
title = ctx.req.params["title"]
308+
preset = ctx.req.query.get("preset", default_voice_preset)
306309
body = ctx.req.data
307310

308311
if body is None:
309312
ctx.res.status = 400
310313
return
311314

312-
await generate_podcast.submit({"title": title, "prompt": body.decode('utf-8')})
315+
await generate_podcast.submit({"title": title, "prompt": body.decode('utf-8'), "preset": preset})
313316

314317
Nitric.run()
315318
```

0 commit comments

Comments
 (0)