Arafath10 commited on
Commit
ae5f2f2
·
verified ·
1 Parent(s): be531b6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -3
main.py CHANGED
@@ -8,8 +8,6 @@ import os
8
  import uuid,requests
9
  import data_collector as dc
10
 
11
- data,message = get_data(b_id=637,product_name = "RS 10 TOFFEE")
12
-
13
  app = FastAPI()
14
  app.add_middleware(
15
  CORSMiddleware,
@@ -19,7 +17,20 @@ app.add_middleware(
19
  allow_headers=["*"],
20
  )
21
 
 
 
 
22
 
23
 
24
  @app.post("/get_image_for_text")
25
- async def get_image_for_text(email,query,file: UploadFile = File(...)):
 
 
 
 
 
 
 
 
 
 
 
8
  import uuid,requests
9
  import data_collector as dc
10
 
 
 
11
  app = FastAPI()
12
  app.add_middleware(
13
  CORSMiddleware,
 
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
+ full_trend,forecasted_value,rounded_value = forecast(monthly_sales)
35
+ print(full_trend,forecasted_value,rounded_value)
36
+ return rounded_value