Spaces:
Sleeping
Sleeping
Commit
·
26ad899
1
Parent(s):
8ce5b5b
Changed temporary response from fast api
Browse files
app.py
CHANGED
|
@@ -82,6 +82,97 @@ def get_prediction_from_jobrun():
|
|
| 82 |
|
| 83 |
@app.post("/get_prediction_on_userinput")
|
| 84 |
def run_pred_pipeline(input: PredictionInput):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
print(f"Here is the input dict : {input.dict()}")
|
| 86 |
print(f"Running the pipeline : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ")
|
| 87 |
|
|
|
|
| 82 |
|
| 83 |
@app.post("/get_prediction_on_userinput")
|
| 84 |
def run_pred_pipeline(input: PredictionInput):
|
| 85 |
+
|
| 86 |
+
print(f"Here is the input dict : {input.dict()}")
|
| 87 |
+
print(f"Running the pipeline : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ")
|
| 88 |
+
|
| 89 |
+
## Hardcoding for testing purposes ##
|
| 90 |
+
data_out = {
|
| 91 |
+
"status" : "success",
|
| 92 |
+
"data" : {
|
| 93 |
+
"id": input.dict()['id'],
|
| 94 |
+
"predictions": {
|
| 95 |
+
"ASDA": {
|
| 96 |
+
"Apr-25": 741.86,
|
| 97 |
+
"May-25": 2624.14,
|
| 98 |
+
"Jun-25": 808.83,
|
| 99 |
+
"Jul-25": 923.99,
|
| 100 |
+
"Aug-25": 280.57,
|
| 101 |
+
"Sep-25": 13.72,
|
| 102 |
+
"Oct-25": 20.58,
|
| 103 |
+
"Nov-25": 23.9,
|
| 104 |
+
"Dec-25": 1619.17,
|
| 105 |
+
"Jan-26": 1123.3,
|
| 106 |
+
"Feb-26": 235.05,
|
| 107 |
+
"Mar-26": 162.03,
|
| 108 |
+
"Apr-26": 410.15
|
| 109 |
+
},
|
| 110 |
+
"MORRISONS": {
|
| 111 |
+
"Apr-25": 2331.82,
|
| 112 |
+
"May-25": 12573.63,
|
| 113 |
+
"Jun-25": 8536.11,
|
| 114 |
+
"Jul-25": 11987.12,
|
| 115 |
+
"Aug-25": 7898.69,
|
| 116 |
+
"Sep-25": 6396.44,
|
| 117 |
+
"Oct-25": 6263.68,
|
| 118 |
+
"Nov-25": 4706.39,
|
| 119 |
+
"Dec-25": 4583.83,
|
| 120 |
+
"Jan-26": 5898.89,
|
| 121 |
+
"Feb-26": 4337.92,
|
| 122 |
+
"Mar-26": 6339.77,
|
| 123 |
+
"Apr-26": 5191.83
|
| 124 |
+
},
|
| 125 |
+
"SAINSBURYS": {
|
| 126 |
+
"Apr-25": 392.79,
|
| 127 |
+
"May-25": 4353.46,
|
| 128 |
+
"Jun-25": 2627.94,
|
| 129 |
+
"Jul-25": 3361.95,
|
| 130 |
+
"Aug-25": 5763.03,
|
| 131 |
+
"Sep-25": 2985.44,
|
| 132 |
+
"Oct-25": 3457.49,
|
| 133 |
+
"Nov-25": 2631.01,
|
| 134 |
+
"Dec-25": 2645.14,
|
| 135 |
+
"Jan-26": 3034.98,
|
| 136 |
+
"Feb-26": 2958.94,
|
| 137 |
+
"Mar-26": 4043.73,
|
| 138 |
+
"Apr-26": 3364.26
|
| 139 |
+
},
|
| 140 |
+
"TESCO": {
|
| 141 |
+
"Apr-25": 2302.79,
|
| 142 |
+
"May-25": 18921.9,
|
| 143 |
+
"Jun-25": 17958.08,
|
| 144 |
+
"Jul-25": 18710.57,
|
| 145 |
+
"Aug-25": 13609.1,
|
| 146 |
+
"Sep-25": 18693.05,
|
| 147 |
+
"Oct-25": 21091.39,
|
| 148 |
+
"Nov-25": 18796.81,
|
| 149 |
+
"Dec-25": 21114.51,
|
| 150 |
+
"Jan-26": 20039.52,
|
| 151 |
+
"Feb-26": 21608.5,
|
| 152 |
+
"Mar-26": 22534.27,
|
| 153 |
+
"Apr-26": 16405.85
|
| 154 |
+
},
|
| 155 |
+
"TOTAL_MARKET": {
|
| 156 |
+
"Apr-25": 10964.68,
|
| 157 |
+
"May-25": 77262.14,
|
| 158 |
+
"Jun-25": 62432.31,
|
| 159 |
+
"Jul-25": 76078.74,
|
| 160 |
+
"Aug-25": 52031.48,
|
| 161 |
+
"Sep-25": 47737.41,
|
| 162 |
+
"Oct-25": 51094.34,
|
| 163 |
+
"Nov-25": 42181.84,
|
| 164 |
+
"Dec-25": 47680.7,
|
| 165 |
+
"Jan-26": 50010.67,
|
| 166 |
+
"Feb-26": 46154.89,
|
| 167 |
+
"Mar-26": 49339.0,
|
| 168 |
+
"Apr-26": 39747.65
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
return data_out
|
| 175 |
+
|
| 176 |
print(f"Here is the input dict : {input.dict()}")
|
| 177 |
print(f"Running the pipeline : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ")
|
| 178 |
|