Spaces:
Sleeping
Sleeping
Commit ·
7a3d85a
1
Parent(s): e106b6e
Removed pycache and test.py from tracking :) [idk even after adding it to gitignore how it got pushed]
Browse files- __pycache__/main.cpython-313.pyc +0 -0
- test.py +0 -16
__pycache__/main.cpython-313.pyc
DELETED
|
Binary file (19.4 kB)
|
|
|
test.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
import json
|
| 3 |
-
|
| 4 |
-
base = "https://p-karthik-mohan-sql-analyst-env.hf.space"
|
| 5 |
-
|
| 6 |
-
sql = "SELECT c.customer_id, c.first_name, c.last_name, SUM(CASE WHEN STRFTIME('%m', o.order_date) BETWEEN '01' AND '06' THEN o.total_amount ELSE 0 END) AS h1_revenue, SUM(CASE WHEN STRFTIME('%m', o.order_date) BETWEEN '07' AND '12' THEN o.total_amount ELSE 0 END) AS h2_revenue FROM orders o JOIN customers c ON o.customer_id = c.customer_id WHERE o.status = 'completed' AND o.order_date LIKE '2024%' GROUP BY c.customer_id HAVING h2_revenue > h1_revenue ORDER BY h2_revenue DESC"
|
| 7 |
-
|
| 8 |
-
requests.post(f"{base}/reset", json={"task_id": 8})
|
| 9 |
-
r = requests.post(f"{base}/step", json={"action": sql})
|
| 10 |
-
data = r.json()
|
| 11 |
-
|
| 12 |
-
print("Reward:", data["reward"])
|
| 13 |
-
print("Breakdown:", json.dumps(data["observation"]["reward_breakdown"], indent=2))
|
| 14 |
-
print("First 2 rows agent got:")
|
| 15 |
-
for row in data["observation"]["result_preview"][:2]:
|
| 16 |
-
print(" ", row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|