Tschoui commited on
Commit
4eb4266
Β·
1 Parent(s): 4c1b5d1
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +12 -0
  3. tests/test_app.py +15 -0
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -24,6 +24,18 @@ class Response(BaseModel):
24
 
25
  app = FastAPI(title="toxicity-api")
26
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  @app.get("/metadata")
28
  def metadata():
29
  return {
 
24
 
25
  app = FastAPI(title="toxicity-api")
26
 
27
+ @app.get("/")
28
+ def root():
29
+ return {
30
+ "message": "Toxicity Prediction API",
31
+ "endpoints": {
32
+ "/metadata": "GET - API metadata and capabilities",
33
+ "/healthz": "GET - Health check",
34
+ "/predict": "POST - Predict toxicity for SMILES"
35
+ },
36
+ "usage": "Send POST to /predict with {'smiles': ['your_smiles_here']} and Authorization header"
37
+ }
38
+
39
  @app.get("/metadata")
40
  def metadata():
41
  return {
tests/test_app.py CHANGED
@@ -15,6 +15,21 @@ def client():
15
  return TestClient(app)
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  class TestMetadataEndpoint:
19
 
20
  def test_metadata(self, client):
 
15
  return TestClient(app)
16
 
17
 
18
+ class TestRootEndpoint:
19
+
20
+ def test_root(self, client):
21
+ response = client.get("/")
22
+ assert response.status_code == 200
23
+ data = response.json()
24
+
25
+ assert data["message"] == "Toxicity Prediction API"
26
+ assert "endpoints" in data
27
+ assert "usage" in data
28
+ assert "/metadata" in data["endpoints"]
29
+ assert "/healthz" in data["endpoints"]
30
+ assert "/predict" in data["endpoints"]
31
+
32
+
33
  class TestMetadataEndpoint:
34
 
35
  def test_metadata(self, client):