12345678910111213141516 |
- import uvicorn
- from fastapi import FastAPI
- from pipeline import pipeline
- app = FastAPI()
- @app.post('/predict_land_price')
- async def predict_land_price(city_name: str = "", year: int = -1, land_type: str = "工业用地(万元/㎡)",
- policy_factors=None):
- pred_result, pred_feather = pipeline(city_name, year, land_type, policy_factors)
- return {"message": "ok", "pred_result": round(float(pred_result), 4), "pred_feather": pred_feather}
- if __name__ == '__main__':
- uvicorn.run(app, **{'host': '0.0.0.0', 'port': 8516, 'log_level': 'info'})
|