Spaces:
Sleeping
Sleeping
cleaning, api desc added
Browse files7 unmodified lines89101112131415161718192021222378 unmodified lines1021031041051061071081091101111121131141151161171181191201217 unmodified linesimport jsonimport logging# logger = logging.getLogger(__name__)logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)# logging.debug('This is a debug message')# logging.info('This is an info message')# logging.warning('This is a warning message')# logging.error('This is an error message')# logging.critical('This is a critical message')# Util Functions & Classesdef loading(fp):with open(fp, "rb") as f:78 unmodified linesreturn [i.dict() for i in cls.inputs]# APIapp = FastAPI(title="API")ml_objects = loading(fp=os.path.join("assets", "ml", "crop_recommandation2.pkl"))## Extract the ml componentsmodel = ml_objects["model"]scaler = ml_objects["scaler"].set_output(transform="pandas")labels = ml_objects["labels"]# = ml_objects[""]# Endpoints@app.get("/")def root():return {"API": " This is an API to ... ."}@app.get("/checkup")7 unmodified lines891011121314151678 unmodified lines95969798991001011021031041051061071081091101111121131141151167 unmodified linesimport jsonimport logging# loggerlogging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)# Util Functions & Classesdef loading(fp):with open(fp, "rb") as f:78 unmodified linesreturn [i.dict() for i in cls.inputs]# API Configapp = FastAPI(title="Agri-Tech API",description="This is a ML API for classification of crop to plant on a land regarding some features")# ML Configml_objects = loading(fp=os.path.join("assets", "ml", "crop_recommandation2.pkl"))## Extract the ml componentsmodel = ml_objects["model"]scaler = ml_objects["scaler"].set_output(transform="pandas")labels = ml_objects["labels"]# Endpoints@app.get("/")def root():return {"Description": " This is a ML API for classification of crop to plant on a land regarding some features."}@app.get("/checkup")
main.py+7-12