Arafath10 commited on
Commit
9914b67
·
verified ·
1 Parent(s): c0eefcc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -5
main.py CHANGED
@@ -57,7 +57,7 @@ async def train_the_model(Tenant: str):
57
  # Select columns
58
  selected_columns = ['customer_name', 'customer_address', 'customer_phone',
59
  'customer_email', 'cod', 'weight', 'origin_city.name',
60
- 'destination_city.name', 'status.name']
61
 
62
  # Handling missing values
63
  #data_filled = data[selected_columns].fillna('Missing')
@@ -126,7 +126,10 @@ async def your_continuous_function(page: int,paginate: int,Tenant: str):
126
 
127
 
128
  # Update the payload for each page
129
- url = "https://dev3.api.curfox.parallaxtec.com/api/ml/order-list?sort=id&paginate="+str(paginate)+"&page="+str(page)
 
 
 
130
 
131
  payload = {}
132
  headers = {
@@ -161,7 +164,7 @@ async def your_continuous_function(page: int,paginate: int,Tenant: str):
161
 
162
  df.to_csv(f"model/{Tenant}trainer_data.csv")
163
  print("data created")
164
- return {"message":"done","page_number":page,"data_count":data_count}
165
 
166
 
167
 
@@ -194,7 +197,9 @@ def predict(
194
  pickup_address: str,
195
  origin_city_name: str,
196
  destination_city_name: str,
197
- origin_country: str):
 
 
198
 
199
  try:
200
  # Load your trained model and encoders
@@ -223,7 +228,8 @@ def predict(
223
  'cod': float(cod),
224
  'weight': float(weight),
225
  'origin_city.name':origin_city_name,
226
- 'destination_city.name':destination_city_name
 
227
  }
228
  input_df = pd.DataFrame([input_data])
229
 
 
57
  # Select columns
58
  selected_columns = ['customer_name', 'customer_address', 'customer_phone',
59
  'customer_email', 'cod', 'weight', 'origin_city.name',
60
+ 'destination_city.name','created_at','status.name']
61
 
62
  # Handling missing values
63
  #data_filled = data[selected_columns].fillna('Missing')
 
126
 
127
 
128
  # Update the payload for each page
129
+
130
+ #url = "https://dev3.api.curfox.parallaxtec.com/api/ml/order-list?sort=id&paginate="+str(paginate)+"&page="+str(page)
131
+ url = "https://v1.api.curfox.com/api/ml/order-list?sort=id&paginate="+str(paginate)+"&page="+str(page)
132
+
133
 
134
  payload = {}
135
  headers = {
 
164
 
165
  df.to_csv(f"model/{Tenant}trainer_data.csv")
166
  print("data created")
167
+ return {"message":"done","page_number":page,"data_count":data_count,'X-Tenant': Tenant}
168
 
169
 
170
 
 
197
  pickup_address: str,
198
  origin_city_name: str,
199
  destination_city_name: str,
200
+ origin_country: str,
201
+ created_at: str
202
+ ):
203
 
204
  try:
205
  # Load your trained model and encoders
 
228
  'cod': float(cod),
229
  'weight': float(weight),
230
  'origin_city.name':origin_city_name,
231
+ 'destination_city.name':destination_city_name,
232
+ 'created_at':created_at
233
  }
234
  input_df = pd.DataFrame([input_data])
235