previous root commented
Browse files
main.py
CHANGED
|
@@ -105,6 +105,13 @@ app = FastAPI(
|
|
| 105 |
description="This is a ML API for classification of crop to plant on a land regarding some features",
|
| 106 |
)
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
# ML Config
|
| 109 |
ml_objects = loading(fp=os.path.join("assets", "ml", "crop_recommandation2.pkl"))
|
| 110 |
## Extract the ml components
|
|
@@ -114,19 +121,12 @@ labels = ml_objects["labels"]
|
|
| 114 |
|
| 115 |
|
| 116 |
# Endpoints
|
| 117 |
-
@app.get("/")
|
| 118 |
-
def root():
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
# Configure static and template files
|
| 126 |
-
app.mount(
|
| 127 |
-
"/static", StaticFiles(directory="assets/static"), name="static"
|
| 128 |
-
) # Mount static files
|
| 129 |
-
templates = Jinja2Templates(directory="assets/templates") # Mount templates for HTML
|
| 130 |
|
| 131 |
|
| 132 |
# Root endpoint to serve index.html template
|
|
|
|
| 105 |
description="This is a ML API for classification of crop to plant on a land regarding some features",
|
| 106 |
)
|
| 107 |
|
| 108 |
+
## Configure static and template files
|
| 109 |
+
app.mount(
|
| 110 |
+
"/static", StaticFiles(directory="assets/static"), name="static"
|
| 111 |
+
) # Mount static files
|
| 112 |
+
templates = Jinja2Templates(directory="assets/templates") # Mount templates for HTML
|
| 113 |
+
|
| 114 |
+
|
| 115 |
# ML Config
|
| 116 |
ml_objects = loading(fp=os.path.join("assets", "ml", "crop_recommandation2.pkl"))
|
| 117 |
## Extract the ml components
|
|
|
|
| 121 |
|
| 122 |
|
| 123 |
# Endpoints
|
| 124 |
+
# @app.get("/")
|
| 125 |
+
# def root():
|
| 126 |
+
# return {
|
| 127 |
+
# "Description": " This is a ML API for classification of crop to plant on a land regarding some features.",
|
| 128 |
+
# "Documentation": "Go to the docs: https://eaedk-agri-tech-fastapi.hf.space/docs",
|
| 129 |
+
# }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
|
| 132 |
# Root endpoint to serve index.html template
|