Download app.py from scott2srikanth/askmynotes_classifier: direct link, hf CLI and curl.
- Browser
- Download file 486 Bytes
-
https://huggingface.co/spaces/scott2srikanth/askmynotes_classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/scott2srikanth/askmynotes_classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/scott2srikanth/askmynotes_classifier/resolve/main/app.py
486 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| import joblib | |
| app = FastAPI() | |
| model = joblib.load("askmynotes_classifier.pkl") | |
| class QuestionRequest(BaseModel): | |
| question: str | |
| def home(): | |
| return {"message": "AskMyNotes Classifier API Running"} | |
| def predict(data: QuestionRequest): | |
| prediction = model.predict([data.question])[0] | |
| return { | |
| "question": data.question, | |
| "predicted_category": prediction | |
| } |