Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -20,8 +20,8 @@ app.add_middleware(
|
|
20 |
|
21 |
|
22 |
|
23 |
-
@app.post("/
|
24 |
-
async def
|
25 |
# main
|
26 |
data,message = dc.get_data(b_id = b_id , product_name = product_name)
|
27 |
|
@@ -33,4 +33,10 @@ async def get_image_for_text(b_id:int,product_name:str):
|
|
33 |
|
34 |
full_trend,forecasted_value,rounded_value = dc.forecast(monthly_sales)
|
35 |
print(full_trend,forecasted_value,rounded_value)
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
|
23 |
+
@app.post("/get_product_count_prediction")
|
24 |
+
async def get_product_count_prediction(b_id:int,product_name:str):
|
25 |
# main
|
26 |
data,message = dc.get_data(b_id = b_id , product_name = product_name)
|
27 |
|
|
|
33 |
|
34 |
full_trend,forecasted_value,rounded_value = dc.forecast(monthly_sales)
|
35 |
print(full_trend,forecasted_value,rounded_value)
|
36 |
+
|
37 |
+
rounded_value.columns = ["next_month", "y", "predicted_count"]
|
38 |
+
|
39 |
+
# Convert to dictionary
|
40 |
+
result_dict = rounded_value.to_dict(orient="records")[0]
|
41 |
+
|
42 |
+
return result_dict
|