Spaces:
Sleeping
Sleeping
Download app.py from amitansu1024/svm-model: direct link, hf CLI and curl.
- Browser
- Download file 655 Bytes
-
https://huggingface.co/spaces/amitansu1024/svm-model/resolve/main/app.py
- Command line
-
hf download hf://spaces/amitansu1024/svm-model/app.py
-
curl -L -o app.py https://huggingface.co/spaces/amitansu1024/svm-model/resolve/main/app.py
655 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from utils import init_model, inference | |
| app = FastAPI() | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins="*", # Allow only specified origins | |
| allow_credentials=True, # Allow credentials (e.g., cookies) | |
| allow_methods=["*"], # Allow all HTTP methods (GET, POST, etc.) | |
| allow_headers=["*"], # Allow all headers | |
| ) | |
| # initializing the model | |
| model = init_model("BooksDataSet.csv", "model.pkl") | |
| def model_inference( | |
| tokens : str | |
| ): | |
| return inference(model, tokens) | |
| def greet_json(): | |
| return {"Hello": "World!"} | |