Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -348,19 +348,6 @@ async def startup_event():
|
|
| 348 |
"""Load model on startup"""
|
| 349 |
await load_model()
|
| 350 |
|
| 351 |
-
@app.get("/")
|
| 352 |
-
async def root():
|
| 353 |
-
SegmentationRequest request = {image_url: HttpUrl
|
| 354 |
-
settings: Optional[Dict] = {
|
| 355 |
-
"padding": 15,
|
| 356 |
-
"background": "white",
|
| 357 |
-
"quality": "high",
|
| 358 |
-
"outline": "grey_2px"
|
| 359 |
-
}
|
| 360 |
-
}
|
| 361 |
-
segment_fashion_items(request)
|
| 362 |
-
return {"message": "Successfully Finished Execution!", "version": "1.0.0"}
|
| 363 |
-
|
| 364 |
@app.get("/health")
|
| 365 |
async def health_check():
|
| 366 |
return {
|
|
@@ -493,6 +480,20 @@ async def get_transformed_url(
|
|
| 493 |
except Exception as e:
|
| 494 |
logger.error(f"Failed to generate transformed URL: {e}")
|
| 495 |
raise HTTPException(status_code=500, detail=f"URL generation failed: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
|
| 497 |
if __name__ == "__main__":
|
| 498 |
import uvicorn
|
|
|
|
| 348 |
"""Load model on startup"""
|
| 349 |
await load_model()
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
@app.get("/health")
|
| 352 |
async def health_check():
|
| 353 |
return {
|
|
|
|
| 480 |
except Exception as e:
|
| 481 |
logger.error(f"Failed to generate transformed URL: {e}")
|
| 482 |
raise HTTPException(status_code=500, detail=f"URL generation failed: {e}")
|
| 483 |
+
|
| 484 |
+
@app.get("/")
|
| 485 |
+
async def root():
|
| 486 |
+
request = {
|
| 487 |
+
"image_url": "https://res.cloudinary.com/dyvuvklpk/image/upload/v1750955465/samples/man-portrait.jpg",
|
| 488 |
+
"settings": {
|
| 489 |
+
"padding": 15,
|
| 490 |
+
"background": "white",
|
| 491 |
+
"quality": "high",
|
| 492 |
+
"outline": "grey_2px"
|
| 493 |
+
}
|
| 494 |
+
}
|
| 495 |
+
await segment_fashion_items(SegmentationRequest(**request))
|
| 496 |
+
return {"message": "Successfully Finished Execution!", "version": "1.0.0"}
|
| 497 |
|
| 498 |
if __name__ == "__main__":
|
| 499 |
import uvicorn
|