Spaces:
Sleeping
Sleeping
Download app/api/reset.py from adityasarade/wasserstoff: direct link, hf CLI and curl.
- Browser
- Download file 544 Bytes
-
https://huggingface.co/spaces/adityasarade/wasserstoff/resolve/main/app/api/reset.py
- Command line
-
hf download hf://spaces/adityasarade/wasserstoff/app/api/reset.py
-
curl -L -o reset.py https://huggingface.co/spaces/adityasarade/wasserstoff/resolve/main/app/api/reset.py
544 Bytes
| import os | |
| from fastapi import APIRouter | |
| from fastapi.responses import JSONResponse | |
| from app.config import params | |
| router = APIRouter() | |
| def reset_vector_store(): | |
| vector_dir = params["paths"]["vector_store_dir"] | |
| index_path = os.path.join(vector_dir, params["paths"]["index_file"]) | |
| meta_path = os.path.join(vector_dir, params["paths"]["metadata_file"]) | |
| for p in (index_path, meta_path): | |
| if os.path.exists(p): | |
| os.remove(p) | |
| return JSONResponse({"message": "Knowledge base cleared."}) |