Spaces:
Sleeping
Sleeping
dangminh214
commited on
Commit
·
297336b
1
Parent(s):
fade8e0
adjust to serve frontend
Browse files
server.py
CHANGED
|
@@ -2,6 +2,7 @@ from fastapi import FastAPI
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
import pickle
|
| 4 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 5 |
|
| 6 |
# Load the pre-trained model and vectorizer
|
| 7 |
with open("spam_classifier_model.pkl", "rb") as model_file:
|
|
@@ -50,4 +51,8 @@ def get_info():
|
|
| 50 |
info = "Welcome to Dang Minh EMail Spam Classifier Model, this is a personal project to practice my knowledge in NLP and MLops"
|
| 51 |
return {
|
| 52 |
"info": info
|
| 53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
import pickle
|
| 4 |
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
+
from fastapi.responses import FileResponse
|
| 6 |
|
| 7 |
# Load the pre-trained model and vectorizer
|
| 8 |
with open("spam_classifier_model.pkl", "rb") as model_file:
|
|
|
|
| 51 |
info = "Welcome to Dang Minh EMail Spam Classifier Model, this is a personal project to practice my knowledge in NLP and MLops"
|
| 52 |
return {
|
| 53 |
"info": info
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
@app.get("/app")
|
| 57 |
+
def serve_frontend():
|
| 58 |
+
return FileResponse("web/index.html")
|