Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -14,8 +14,8 @@ async def add_process_time_header(request: Request, call_next):
|
|
| 14 |
return JSONResponse(status_code=500, content={"message": str(exc)})
|
| 15 |
|
| 16 |
# Load the datasets from the Hugging Face Hub
|
| 17 |
-
customers_dataset = load_dataset("dwb2023/customers", split="train")
|
| 18 |
-
orders_dataset = load_dataset("dwb2023/orders", split="train")
|
| 19 |
|
| 20 |
class GetUserInput(BaseModel):
|
| 21 |
key: str
|
|
@@ -64,7 +64,7 @@ def update_user(input: UpdateUserInput):
|
|
| 64 |
|
| 65 |
if user_found:
|
| 66 |
updated_dataset = Dataset.from_list(customers_data)
|
| 67 |
-
updated_dataset.push_to_hub("dwb2023/customers", split="train")
|
| 68 |
customers_dataset = updated_dataset # Update the global dataset
|
| 69 |
return {"message": "User information updated successfully"}
|
| 70 |
else:
|
|
@@ -100,7 +100,7 @@ def cancel_order(input: CancelOrderInput):
|
|
| 100 |
|
| 101 |
if order_found:
|
| 102 |
updated_orders_dataset = Dataset.from_list(orders_data)
|
| 103 |
-
updated_orders_dataset.push_to_hub("dwb2023/orders", split="train")
|
| 104 |
orders_dataset = updated_orders_dataset # Update the global dataset
|
| 105 |
return {"status": "Cancelled"}
|
| 106 |
else:
|
|
|
|
| 14 |
return JSONResponse(status_code=500, content={"message": str(exc)})
|
| 15 |
|
| 16 |
# Load the datasets from the Hugging Face Hub
|
| 17 |
+
customers_dataset = load_dataset("dwb2023/blackbird-customers", split="train")
|
| 18 |
+
orders_dataset = load_dataset("dwb2023/blackbird-orders", split="train")
|
| 19 |
|
| 20 |
class GetUserInput(BaseModel):
|
| 21 |
key: str
|
|
|
|
| 64 |
|
| 65 |
if user_found:
|
| 66 |
updated_dataset = Dataset.from_list(customers_data)
|
| 67 |
+
updated_dataset.push_to_hub("dwb2023/blackbird-customers", split="train")
|
| 68 |
customers_dataset = updated_dataset # Update the global dataset
|
| 69 |
return {"message": "User information updated successfully"}
|
| 70 |
else:
|
|
|
|
| 100 |
|
| 101 |
if order_found:
|
| 102 |
updated_orders_dataset = Dataset.from_list(orders_data)
|
| 103 |
+
updated_orders_dataset.push_to_hub("dwb2023/blackbird-orders", split="train")
|
| 104 |
orders_dataset = updated_orders_dataset # Update the global dataset
|
| 105 |
return {"status": "Cancelled"}
|
| 106 |
else:
|