Spaces:
Sleeping
Sleeping
Download utils.py from subbunanepalli/LOG_REG: direct link, hf CLI and curl.
- Browser
- Download file 471 Bytes
-
https://huggingface.co/spaces/subbunanepalli/LOG_REG/resolve/main/utils.py
- Command line
-
hf download hf://spaces/subbunanepalli/LOG_REG/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/subbunanepalli/LOG_REG/resolve/main/utils.py
471 Bytes
| import joblib | |
| from fastapi import HTTPException | |
| def load_model_and_vectorizer(model_path, vectorizer_path): | |
| try: | |
| model = joblib.load(model_path) | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=f"Failed to load model: {e}") | |
| try: | |
| vectorizer = joblib.load(vectorizer_path) | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=f"Failed to load vectorizer: {e}") | |
| return model, vectorizer | |