Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,17 @@ from predict import predict_transaction
|
|
| 13 |
|
| 14 |
# Gradio UI
|
| 15 |
def predict_ui(check_id, employee_id, total, discount_amount, item_count, time, terminal_id):
|
|
|
|
|
|
|
|
|
|
| 16 |
return predict_transaction({
|
| 17 |
"check_id": check_id,
|
| 18 |
-
"employee_id": employee_id,
|
| 19 |
"total": total,
|
| 20 |
"discount_amount": discount_amount,
|
| 21 |
"item_count": item_count,
|
| 22 |
-
"time": time,
|
| 23 |
-
"terminal_id": terminal_id
|
| 24 |
})
|
| 25 |
|
| 26 |
demo = gr.Interface(
|
|
|
|
| 13 |
|
| 14 |
# Gradio UI
|
| 15 |
def predict_ui(check_id, employee_id, total, discount_amount, item_count, time, terminal_id):
|
| 16 |
+
if not employee_id or not time or not terminal_id:
|
| 17 |
+
return "Please provide all required fields."
|
| 18 |
+
|
| 19 |
return predict_transaction({
|
| 20 |
"check_id": check_id,
|
| 21 |
+
"employee_id": employee_id.strip(),
|
| 22 |
"total": total,
|
| 23 |
"discount_amount": discount_amount,
|
| 24 |
"item_count": item_count,
|
| 25 |
+
"time": time.strip(),
|
| 26 |
+
"terminal_id": terminal_id.strip()
|
| 27 |
})
|
| 28 |
|
| 29 |
demo = gr.Interface(
|