@@ -173,6 +173,8 @@ In the existing API endpoint in `services/api.py` overwrite with the following.
173173
174174``` python title:services/api.py
175175from 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
178180gen_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
203202Nitric.run()
204203```
@@ -238,7 +237,7 @@ nitric start
238237Once 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
244243Or you can use your favorite API client to test it out.
0 commit comments