Spaces:
Sleeping
Sleeping
Add Post
Browse files
main.py
CHANGED
@@ -39,6 +39,18 @@ static_dir = Path("./static")
|
|
39 |
static_dir.mkdir(parents=True, exist_ok=True)
|
40 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
###############################################################################
|
43 |
# 4) Define your GPU function and main processing function
|
44 |
###############################################################################
|
|
|
39 |
static_dir.mkdir(parents=True, exist_ok=True)
|
40 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
41 |
|
42 |
+
@app.post("/echo-image/",
|
43 |
+
tags=["Test"],
|
44 |
+
description="Descripci贸n",
|
45 |
+
summary="Summary"
|
46 |
+
)
|
47 |
+
async def echo_image(image: UploadFile = File(...)):
|
48 |
+
if not image.content_type.startswith("image/"):
|
49 |
+
return {"error": "El archivo no es una imagen"}
|
50 |
+
|
51 |
+
contents = await image.read()
|
52 |
+
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
53 |
+
|
54 |
###############################################################################
|
55 |
# 4) Define your GPU function and main processing function
|
56 |
###############################################################################
|