Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -17,7 +17,7 @@ app.add_middleware(
|
|
17 |
allow_headers=["*"],
|
18 |
)
|
19 |
|
20 |
-
def insert_data(
|
21 |
import mysql.connector
|
22 |
import json
|
23 |
|
@@ -46,7 +46,7 @@ def insert_data(bid,forecast_data):#mysql-connector-python
|
|
46 |
"""
|
47 |
|
48 |
# Execute the SQL command with data
|
49 |
-
cursor.execute(insert_query, (
|
50 |
|
51 |
# Commit the transaction
|
52 |
connection.commit()
|
@@ -230,7 +230,7 @@ async def generate_product_count_prediction(b_id: int):
|
|
230 |
|
231 |
|
232 |
delete_json(b_id)
|
233 |
-
insert_data(
|
234 |
return {"status": "success",
|
235 |
"b_id":b_id,
|
236 |
"message": "Prediction successful and saved to DB",
|
|
|
17 |
allow_headers=["*"],
|
18 |
)
|
19 |
|
20 |
+
def insert_data(b_id,forecast_data):#mysql-connector-python
|
21 |
import mysql.connector
|
22 |
import json
|
23 |
|
|
|
46 |
"""
|
47 |
|
48 |
# Execute the SQL command with data
|
49 |
+
cursor.execute(insert_query, (b_id, forecast_data_json))
|
50 |
|
51 |
# Commit the transaction
|
52 |
connection.commit()
|
|
|
230 |
|
231 |
|
232 |
delete_json(b_id)
|
233 |
+
insert_data(b_id,results)
|
234 |
return {"status": "success",
|
235 |
"b_id":b_id,
|
236 |
"message": "Prediction successful and saved to DB",
|