asamasach commited on
Commit
74ae6b5
·
1 Parent(s): f0ccd51

Add /models API endpoint to list available detection models

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -397,6 +397,15 @@ with gr.Blocks(title="Industrial Defect Detection") as demo:
397
  - Tire Cord
398
  """)
399
 
 
 
 
 
 
 
 
 
 
400
  # Launch the app
401
  if __name__ == "__main__":
402
  demo.launch()
 
397
  - Tire Cord
398
  """)
399
 
400
+ # Add custom endpoint for listing models
401
+ @demo.api_endpoint("/models", method="GET")
402
+ def list_models():
403
+ """API endpoint to list available models."""
404
+ return {
405
+ "models": [model_info["name"] for model_info in MODELS.values()],
406
+ "count": len(MODELS)
407
+ }
408
+
409
  # Launch the app
410
  if __name__ == "__main__":
411
  demo.launch()