Arafath10 commited on
Commit
318071e
·
verified ·
1 Parent(s): 0940737

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -3
main.py CHANGED
@@ -20,8 +20,8 @@ app.add_middleware(
20
 
21
 
22
 
23
- @app.post("/get_image_for_text")
24
- async def get_image_for_text(b_id:int,product_name:str):
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
- return {"predicted_count" : str(rounded_value)}
 
 
 
 
 
 
 
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