Spaces:
Runtime error
Runtime error
Primer función
Browse files
app.py
CHANGED
|
@@ -29,6 +29,16 @@ async def echo_image(image: UploadFile = File(...)):
|
|
| 29 |
contents = await image.read()
|
| 30 |
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
@app.post("/genera-imagen/")
|
| 33 |
async def genera_imagen(platillo: str = Form(...)):
|
| 34 |
|
|
|
|
| 29 |
contents = await image.read()
|
| 30 |
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
| 31 |
|
| 32 |
+
@app.post("/procesa-dni/",
|
| 33 |
+
description="Procesa DNI.",
|
| 34 |
+
summary="Summary"
|
| 35 |
+
)
|
| 36 |
+
async def echo_image(image: UploadFile = File(...)):
|
| 37 |
+
if not image.content_type.startswith("image/"):
|
| 38 |
+
return {"error": "El archivo no es una imagen"}
|
| 39 |
+
contents = await image.read()
|
| 40 |
+
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
| 41 |
+
|
| 42 |
@app.post("/genera-imagen/")
|
| 43 |
async def genera_imagen(platillo: str = Form(...)):
|
| 44 |
|