| import pickle | |
| import pandas as pd | |
| # Load the ARIMA model | |
| with open("arima_model.pkl", "rb") as f: | |
| model = pickle.load(f) | |
| def predict_stock(input_data): | |
| """ | |
| input_data: dictionary with structure like {"feature": value} | |
| For ARIMA, usually you just forecast next n steps. | |
| """ | |
| # Example: forecasting next n steps | |
| n_steps = input_data.get("steps", 5) | |
| forecast = model.forecast(steps=n_steps) | |
| return forecast.tolist() | |
| # Example usage | |
| if __name__ == "__main__": | |
| data = {"steps": 10} | |
| print(predict_stock(data)) | |