Add root route to FastAPI app
Browse files- app/main.py +5 -0
 
    	
        app/main.py
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 1 | 
         
             
            from fastapi import FastAPI, HTTPException
         
     | 
| 
         | 
|
| 2 | 
         
             
            from pydantic import BaseModel
         
     | 
| 3 | 
         
             
            from typing import List, Union, Optional, Dict
         
     | 
| 4 | 
         
             
            import logging
         
     | 
| 
         @@ -15,6 +16,10 @@ app = FastAPI( 
     | 
|
| 15 | 
         
             
                version="1.0.0"
         
     | 
| 16 | 
         
             
            )
         
     | 
| 17 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 18 | 
         
             
            class TextInput(BaseModel):
         
     | 
| 19 | 
         
             
                text: Union[str, List[str]]
         
     | 
| 20 | 
         | 
| 
         | 
|
| 1 | 
         
             
            from fastapi import FastAPI, HTTPException
         
     | 
| 2 | 
         
            +
            from fastapi.responses import JSONResponse
         
     | 
| 3 | 
         
             
            from pydantic import BaseModel
         
     | 
| 4 | 
         
             
            from typing import List, Union, Optional, Dict
         
     | 
| 5 | 
         
             
            import logging
         
     | 
| 
         | 
|
| 16 | 
         
             
                version="1.0.0"
         
     | 
| 17 | 
         
             
            )
         
     | 
| 18 | 
         | 
| 19 | 
         
            +
            @app.get("/")
         
     | 
| 20 | 
         
            +
            def read_root():
         
     | 
| 21 | 
         
            +
                return JSONResponse({"message": "Cancer Classify & Extract API is live 🚀"})
         
     | 
| 22 | 
         
            +
             
     | 
| 23 | 
         
             
            class TextInput(BaseModel):
         
     | 
| 24 | 
         
             
                text: Union[str, List[str]]
         
     | 
| 25 | 
         |