Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,10 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 15 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint).to(device)
|
| 16 |
predictor = SamPredictor(sam)
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
@app.post("/segment")
|
| 19 |
async def segment_image(file: UploadFile = File(...)):
|
| 20 |
image_bytes = await file.read()
|
|
|
|
| 15 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint).to(device)
|
| 16 |
predictor = SamPredictor(sam)
|
| 17 |
|
| 18 |
+
@app.get("/")
|
| 19 |
+
def read_root():
|
| 20 |
+
return {"status": "SAM API is running"}
|
| 21 |
+
|
| 22 |
@app.post("/segment")
|
| 23 |
async def segment_image(file: UploadFile = File(...)):
|
| 24 |
image_bytes = await file.read()
|