Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -17,20 +17,19 @@ app.add_middleware(
|
|
17 |
allow_headers=["*"],
|
18 |
)
|
19 |
|
20 |
-
# main
|
21 |
-
data,message = dc.get_data(b_id=637,product_name = "RS 10 TOFFEE")
|
22 |
-
print(message)
|
23 |
|
24 |
|
25 |
@app.post("/get_image_for_text")
|
26 |
async def get_image_for_text(b_id:int,product_name:str):
|
27 |
# main
|
28 |
data,message = dc.get_data(b_id = b_id , product_name = product_name)
|
|
|
29 |
if message=="done":
|
30 |
# Summarize the sales count per month
|
31 |
data['transaction_date'] = pd.to_datetime(data['transaction_date'])
|
32 |
data.set_index('transaction_date', inplace=True)
|
33 |
monthly_sales = data['sell_qty'].resample('M').sum().reset_index()
|
34 |
-
|
|
|
35 |
print(full_trend,forecasted_value,rounded_value)
|
36 |
return rounded_value
|
|
|
17 |
allow_headers=["*"],
|
18 |
)
|
19 |
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
@app.post("/get_image_for_text")
|
23 |
async def get_image_for_text(b_id:int,product_name:str):
|
24 |
# main
|
25 |
data,message = dc.get_data(b_id = b_id , product_name = product_name)
|
26 |
+
|
27 |
if message=="done":
|
28 |
# Summarize the sales count per month
|
29 |
data['transaction_date'] = pd.to_datetime(data['transaction_date'])
|
30 |
data.set_index('transaction_date', inplace=True)
|
31 |
monthly_sales = data['sell_qty'].resample('M').sum().reset_index()
|
32 |
+
|
33 |
+
full_trend,forecasted_value,rounded_value = dc.forecast(monthly_sales)
|
34 |
print(full_trend,forecasted_value,rounded_value)
|
35 |
return rounded_value
|