File size: 4,994 Bytes
a3d7f6f 1651159 14a0975 a77cdcc 1651159 a77cdcc a3d7f6f 98f91a8 d1ff3e3 966adc4 913877b a3d7f6f 1651159 98f91a8 a3d7f6f d1ff3e3 98f91a8 92c854e 913877b c5ae403 92c854e 98f91a8 122624a 913877b c5ae403 122624a c5ae403 122624a 913877b 122624a c5ae403 913877b c5ae403 913877b c5ae403 eba05c5 913877b eba05c5 913877b eba05c5 a3d7f6f 913877b a3d7f6f 913877b a3d7f6f 913877b a3d7f6f 913877b a3d7f6f 913877b a3d7f6f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
import funciones
from fastapi import FastAPI, Form
from fastapi import FastAPI, File, UploadFile
from typing import Literal
from fastapi.responses import JSONResponse
app = FastAPI()
# Nuevo endpoint para Health Check
@app.get("/health",
tags=["Health Check"],
description="Verifica el estado de salud de la API.",
summary="Health Check"
)
async def health_check():
"""
Este endpoint devuelve una respuesta 200 OK para indicar que la API está funcionando.
"""
return JSONResponse(content={"status": "ok"}, status_code=200)
@app.post("/partynight/")
async def partynight(
image: UploadFile = File(...),
outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_partynight(image, outfit_color)
@app.post("/babydoll/")
async def babydoll(
image: UploadFile = File(...),
outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_babydoll(image, outfit_color)
@app.post("/leather/")
async def leather(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_leather(image)
@app.post("/stewardess/")
async def stewardess(
image: UploadFile = File(...),
color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_stewardess(image, color)
@app.post("/oktoberfest/")
async def oktoberfest(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_oktoberfest(image)
@app.post("/ghibli/")
async def ghibli(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_ghibli(image)
@app.post("/wildwest/")
async def wildwest(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_wildwest(image)
@app.post("/bride/")
async def bride(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_bride(image)
@app.post("/swimsuit/")
async def swimsuit(
image: UploadFile = File(...),
color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_swimsuit(image, color)
@app.post("/lingerie/")
async def lingerie(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_lingerie(image)
@app.post("/schooluniform/")
async def schooluniform(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_schooluniform(image)
@app.post("/frenchmaid/")
async def frenchmaid(
image: UploadFile = File(...)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_frenchmaid(image)
@app.post("/cheerleader/")
async def cheerleader(
image: UploadFile = File(...),
color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None),
hairstyle: Literal["ponytail", "pigtails", "random", ""] = Form(None)
):
if not image.content_type.startswith("image/"):
return {"error": "The file is not an image."}
return await funciones.crea_cheerleader(image, color, hairstyle) |