yetessam commited on
Commit
968d704
·
verified ·
1 Parent(s): ffbd721

Update checks/failed_check.py

Browse files
Files changed (1) hide show
  1. checks/failed_check.py +19 -16
checks/failed_check.py CHANGED
@@ -33,21 +33,24 @@ def check_app_status():
33
  def get_status():
34
  return check_app_status()
35
 
36
-
37
  # Create the Gradio interface
38
- def create_failed_gradio_ui():
39
- # Define the Gradio interface
40
- interface = gr.Interface(
41
- fn=get_status, # The function to call to get the status
42
- inputs=[], # No inputs; it's just a status display
43
- outputs="text", # Output will be a simple text message
44
- live=True, # Updates automatically when clicked
45
- title="App Status Dashboard", # Title of the Gradio UI
46
- description="This Gradio UI displays the current status of the app. It is only shown when one of the pre-check routines has failed. At this point, there are various reasons why the app might not be working, including endpoint scaling or payment issues.",
47
- )
48
-
49
- # Launch the UI
50
- interface.launch()
51
-
52
-
 
 
 
 
53
 
 
33
  def get_status():
34
  return check_app_status()
35
 
 
36
  # Create the Gradio interface
37
+ def create_failed_gradio_ui(status_info):
38
+ with gr.Blocks() as interface:
39
+ gr.Markdown(f"## Status Code: {status_info['status_code']}")
40
+ gr.Markdown(f"## Message: {status_info['message']}")
41
+ gr.JSON(status_info["response_data"], label="Response Data")
42
+ #return interface
43
+ # Launch the UI
44
+ interface.launch(show_error=True)
45
+
46
+ # Function to check the public endpoint and return the status information
47
+ def check_public_endpoint(endpoint_uri):
48
+ # Simulate the response from the public endpoint
49
+ status_info = {
50
+ "status": False,
51
+ "status_code": 404,
52
+ "response_data": {"error": "Not Found"},
53
+ "message": "The requested resource was not found."
54
+ }
55
+ return status_info
56