Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +3 -3
src/streamlit_app.py
CHANGED
|
@@ -10,7 +10,7 @@ st.set_page_config(
|
|
| 10 |
)
|
| 11 |
|
| 12 |
# FastAPI base URL
|
| 13 |
-
BASE_URL = "https://ritesh1035-
|
| 14 |
|
| 15 |
# Helper functions
|
| 16 |
def make_request(method, endpoint, data=None):
|
|
@@ -28,7 +28,7 @@ def make_request(method, endpoint, data=None):
|
|
| 28 |
|
| 29 |
return response
|
| 30 |
except requests.exceptions.ConnectionError:
|
| 31 |
-
st.error("Cannot connect to FastAPI server. Make sure it's running on https://ritesh1035-
|
| 32 |
return None
|
| 33 |
|
| 34 |
# Main title
|
|
@@ -83,7 +83,7 @@ elif operation == "Add Customer":
|
|
| 83 |
else:
|
| 84 |
# Auto-generate ID based on existing customers count
|
| 85 |
try:
|
| 86 |
-
existing_customers = requests.get("https://ritesh1035-
|
| 87 |
if existing_customers:
|
| 88 |
max_id = max(customer.get('id', 0) for customer in existing_customers)
|
| 89 |
customer_id = max_id + 1
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
# FastAPI base URL
|
| 13 |
+
BASE_URL = "https://ritesh1035-db-backend.hf.space"
|
| 14 |
|
| 15 |
# Helper functions
|
| 16 |
def make_request(method, endpoint, data=None):
|
|
|
|
| 28 |
|
| 29 |
return response
|
| 30 |
except requests.exceptions.ConnectionError:
|
| 31 |
+
st.error("Cannot connect to FastAPI server. Make sure it's running on https://ritesh1035-db-backend.hf.space")
|
| 32 |
return None
|
| 33 |
|
| 34 |
# Main title
|
|
|
|
| 83 |
else:
|
| 84 |
# Auto-generate ID based on existing customers count
|
| 85 |
try:
|
| 86 |
+
existing_customers = requests.get("https://ritesh1035-db-backend.hf.space").json()
|
| 87 |
if existing_customers:
|
| 88 |
max_id = max(customer.get('id', 0) for customer in existing_customers)
|
| 89 |
customer_id = max_id + 1
|