Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -158,9 +158,9 @@ def forecast(monthly_sales):
|
|
158 |
|
159 |
return combined_sales, original_forecasted_value, rounded_value
|
160 |
|
161 |
-
def process_product(product_name, data
|
162 |
full_trend = ""
|
163 |
-
|
164 |
try:
|
165 |
# Get today's date
|
166 |
today = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
|
@@ -211,13 +211,11 @@ async def generate_product_count_prediction(b_id: int):
|
|
211 |
|
212 |
if message == "done":
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
results = []
|
218 |
with ThreadPoolExecutor() as executor:
|
219 |
-
|
220 |
-
futures = [executor.submit(process_product, product_name, sub_sku, product_df.copy()) for (product_name, sub_sku), product_df in grouped_df]
|
221 |
for future in as_completed(futures):
|
222 |
results.append(future.result())
|
223 |
|
|
|
158 |
|
159 |
return combined_sales, original_forecasted_value, rounded_value
|
160 |
|
161 |
+
def process_product(product_name, data):
|
162 |
full_trend = ""
|
163 |
+
print(data)
|
164 |
try:
|
165 |
# Get today's date
|
166 |
today = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
|
|
|
211 |
|
212 |
if message == "done":
|
213 |
|
214 |
+
grouped_df = data.groupby('product_name')
|
215 |
+
|
|
|
216 |
results = []
|
217 |
with ThreadPoolExecutor() as executor:
|
218 |
+
futures = [executor.submit(process_product, product_name, product_df.copy()) for product_name, product_df in grouped_df]
|
|
|
219 |
for future in as_completed(futures):
|
220 |
results.append(future.result())
|
221 |
|