Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,25 +80,32 @@ def wake_up_endpoint(endpoint_uri, max_wait=30):
|
|
| 80 |
|
| 81 |
def main():
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
# Elsewhere in your code:
|
| 85 |
#ui.append("Checking endpoint…")
|
| 86 |
-
|
| 87 |
#ui.shutdown()
|
| 88 |
|
| 89 |
# Load endpoint and check health
|
| 90 |
|
| 91 |
|
| 92 |
# Prechecks
|
|
|
|
|
|
|
|
|
|
| 93 |
endpoint_uri = load_huggingface_model() # Get the URI for the endpoint
|
| 94 |
-
|
| 95 |
|
| 96 |
# Wake it up before health check
|
| 97 |
wake_up_successful = wake_up_endpoint(endpoint_uri)
|
|
|
|
| 98 |
if not wake_up_successful:
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
| 102 |
is_healthy, status_info = check_model_endpoint(endpoint_uri) # Test the endpoint
|
| 103 |
|
| 104 |
if not is_healthy:
|
|
@@ -114,8 +121,5 @@ def main():
|
|
| 114 |
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
-
|
| 118 |
-
ui = StatusUI("🚦 Endpoint Logger")
|
| 119 |
-
ui.launch()
|
| 120 |
|
| 121 |
-
|
|
|
|
| 80 |
|
| 81 |
def main():
|
| 82 |
|
| 83 |
+
ui = StatusUI(" Content Agent ")
|
| 84 |
+
ui.launch()
|
| 85 |
+
|
| 86 |
# Elsewhere in your code:
|
| 87 |
#ui.append("Checking endpoint…")
|
| 88 |
+
|
| 89 |
#ui.shutdown()
|
| 90 |
|
| 91 |
# Load endpoint and check health
|
| 92 |
|
| 93 |
|
| 94 |
# Prechecks
|
| 95 |
+
ui.append("Starting prechecks...")
|
| 96 |
+
ui.append("Checking endpoint..")
|
| 97 |
+
|
| 98 |
endpoint_uri = load_huggingface_model() # Get the URI for the endpoint
|
| 99 |
+
ui.append(endpoint_uri)
|
| 100 |
|
| 101 |
# Wake it up before health check
|
| 102 |
wake_up_successful = wake_up_endpoint(endpoint_uri)
|
| 103 |
+
|
| 104 |
if not wake_up_successful:
|
| 105 |
+
ui.append("Warning: Could not wake up the endpoint. Continuing.")
|
| 106 |
+
elif
|
| 107 |
+
ui.append("✅ End point responded OK.")
|
| 108 |
+
|
| 109 |
is_healthy, status_info = check_model_endpoint(endpoint_uri) # Test the endpoint
|
| 110 |
|
| 111 |
if not is_healthy:
|
|
|
|
| 121 |
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
+
main()
|