MCPcopy Create free account
hub / github.com/chinobing/FastAPI-PaddleSpeech-Audio-To-Text / delete

Function delete

pstext/main.py:98–106  ·  view source on GitHub ↗
(request: Request, audio_id: int, db: Session = Depends(get_db))

Source from the content-addressed store, hash-verified

96
97@application.get("/delete/{audio_id}")
98async def delete(request: Request, audio_id: int, db: Session = Depends(get_db)):
99 # delete info from sqlite3 and return filename
100 filename = crud.delete_audio(db, audio_id)
101 if filename is not None:
102 os.remove(f'{audio_raw_path}/{filename}')
103 shutil.rmtree(f'{audio_output_path}/{filename[:-4]}')
104
105 url = application.url_path_for("home")
106 return RedirectResponse(url=url, status_code=status.HTTP_302_FOUND)
107
108@application.get("/download/{audio_id}")
109async def get_csv(request: Request, audio_id: int, db: Session = Depends(get_db)):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected