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

Commit 0e109d9

Browse files
committed
remove model_id from first api example
1 parent 3a170d9 commit 0e109d9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ In the existing API endpoint in `services/api.py` overwrite with the following.
173173

174174
```python title:services/api.py
175175
from common.resources import main_api, gen_audio_job
176+
from nitric.application import Nitric
177+
from nitric.context import HttpContext
176178

177179
# Give this service permission to submit tasks to the gen_audio_job
178180
gen_audio = gen_audio_job.allow("submit")
@@ -186,9 +188,6 @@ async def submit_auto(ctx: HttpContext):
186188
name = ctx.req.params["filename"]
187189
preset = ctx.req.query.get("preset", default_voice_preset)
188190

189-
if isinstance(model_id, list):
190-
model_id = model_id[0]
191-
192191
if isinstance(preset, list):
193192
preset = preset[0]
194193

@@ -198,7 +197,7 @@ async def submit_auto(ctx: HttpContext):
198197
return
199198

200199
# Submit the audio generation job, this will run the job we defined as an async task
201-
await generate_audio.submit({"file": name, "text": body.decode('utf-8'), "preset": preset})
200+
await gen_audio.submit({"file": name, "text": body.decode('utf-8'), "preset": preset})
202201

203202
Nitric.run()
204203
```
@@ -238,7 +237,7 @@ nitric start
238237
Once its up and running we can test out our API by running:
239238

240239
```bash
241-
curl -X POST http://localhost:8080/audio/test -d "Okay this is cool, but let's wait and see what comes next"
240+
curl -X POST http://localhost:4001/audio/test -d "Okay this is cool, but let's wait and see what comes next"
242241
```
243242

244243
Or you can use your favorite API client to test it out.

0 commit comments

Comments
 (0)