bertugmirasyedi commited on
Commit
a269c60
1 Parent(s): 76bf172

Added get_server_status endpoint

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -518,3 +518,23 @@ async def summarize(descriptions: list, runtime="normal"):
518
  ]
519
 
520
  return summaries
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  ]
519
 
520
  return summaries
521
+
522
+
523
+ @app.get("/get_server_status")
524
+ def get_server_status():
525
+ """
526
+ Return the server status.
527
+ """
528
+ from huggingface_hub import HfApi
529
+
530
+ # Define the Hugging Face API client and Aristotle API space
531
+ hf_api = HfApi()
532
+ space_id = "bertugmirasyedi/aristotle-api"
533
+
534
+ # Get the space runtime information
535
+ runtime = hf_api.get_space_runtime(space_id)
536
+
537
+ # Return the server status
538
+ status = runtime.stage
539
+
540
+ return {"status": status}