Oktoberfest, Ghibli and All
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- app.py +24 -4
- funciones.py +28 -2
- herramientas.py +3 -1
- images/positions/all/Aquaman'sMera-1740943688.jpg +3 -0
- images/positions/all/AwesomeCreature.webp +3 -0
- images/positions/all/Batgirl-1740939359.jpg +3 -0
- images/positions/all/Batgirl-1741071349.jpg +3 -0
- images/positions/all/Batgirl-1741158100.jpg +3 -0
- images/positions/all/BlackWidow-1742080636.jpg +3 -0
- images/positions/all/CaptainMarvel-1740939730.jpg +3 -0
- images/positions/all/CaptainMarvel-1741158610.jpg +3 -0
- images/positions/all/CaptainMarvel-1741210153.jpg +3 -0
- images/positions/all/CaptainMarvel-1741213160.jpg +3 -0
- images/positions/all/Catwoman-1740940080.jpg +3 -0
- images/positions/all/Cohen.jpg +3 -0
- images/positions/all/DC'sMera-1740943597.jpg +3 -0
- images/positions/all/Daredevil'sElektraNatchioswithtrinche-1740954016.jpg +3 -0
- images/positions/all/Desprop-Mera-1740944858.jpg +3 -0
- images/positions/all/Elektra-1740950075.jpg +3 -0
- images/positions/all/ElektraNatchioswithkatana-1740951946.jpg +3 -0
- images/positions/all/Elektrawithcarvingfork.-1740954744.jpg +3 -0
- images/positions/all/Elektrawithkatana-1741156530.jpg +3 -0
- images/positions/all/Elektrawithsaiweapon.-1740956768.jpg +3 -0
- images/positions/all/HarleyQuinn-1741202158.jpg +3 -0
- images/positions/all/HarleyQuinn-1742088853.jpg +3 -0
- images/positions/all/HumanTorch-1741213379.jpg +3 -0
- images/positions/all/Maresa-WonderWoman-1740940866.jpg +3 -0
- images/positions/all/Marvel's Domino-1740365393.jpg +3 -0
- images/positions/all/Marvel'sJeanGrey-1740369341.jpg +3 -0
- images/positions/all/Mera-1740943342.jpg +3 -0
- images/positions/all/Mera-1740944411.jpg +3 -0
- images/positions/all/Mera-1740944510.jpg +3 -0
- images/positions/all/Mera-1741072395.jpg +3 -0
- images/positions/all/Mera-1741202477.jpg +3 -0
- images/positions/all/Mera-1741209845.jpg +3 -0
- images/positions/all/Powergirl-1742090886.jpg +3 -0
- images/positions/all/ScarletWitch-1741158288.jpg +3 -0
- images/positions/all/ScarletWitch-1741201818.jpg +3 -0
- images/positions/all/Slim-ScarletWitch-1741156364.jpg +3 -0
- images/positions/all/SuperheroineOzymandias.webp +3 -0
- images/positions/all/TheWasp-1741813091.jpg +3 -0
- images/positions/all/WhiteQueenEmmaFrost-1742091060.jpg +3 -0
- images/positions/all/XmenArchangel-1740982650.jpg +3 -0
- images/positions/all/XmenArchangelwithwingsspread-1741061925.jpg +3 -0
- images/positions/all/XmenArchangelwithwingsspread-1741061971.jpg +3 -0
- images/positions/all/XmenBeast-1740983870.jpg +3 -0
- images/positions/all/XmenIceman-1740982180.jpg +3 -0
- images/positions/all/XmenIceman-1740982247.jpg +3 -0
- images/positions/all/XmenJeanGrey-1740881140.jpg +3 -0
- images/positions/all/XmenNightcrawler-1740983415.jpg +3 -0
app.py
CHANGED
@@ -16,7 +16,8 @@ async def partynight(
|
|
16 |
@app.post("/babydoll/")
|
17 |
async def babydoll(
|
18 |
image: UploadFile = File(...),
|
19 |
-
outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
|
|
20 |
if not image.content_type.startswith("image/"):
|
21 |
return {"error": "The file is not an image."}
|
22 |
return await funciones.crea_babydoll(image, outfit_color)
|
@@ -24,10 +25,11 @@ async def babydoll(
|
|
24 |
@app.post("/leather/")
|
25 |
async def leather(
|
26 |
image: UploadFile = File(...),
|
27 |
-
outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
|
|
28 |
if not image.content_type.startswith("image/"):
|
29 |
return {"error": "The file is not an image."}
|
30 |
-
return await funciones.crea_leather(image
|
31 |
|
32 |
@app.post("/stewardess/")
|
33 |
async def stewardess(
|
@@ -35,4 +37,22 @@ async def stewardess(
|
|
35 |
color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)):
|
36 |
if not image.content_type.startswith("image/"):
|
37 |
return {"error": "The file is not an image."}
|
38 |
-
return await funciones.crea_stewardess(image, color)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
@app.post("/babydoll/")
|
17 |
async def babydoll(
|
18 |
image: UploadFile = File(...),
|
19 |
+
outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
20 |
+
):
|
21 |
if not image.content_type.startswith("image/"):
|
22 |
return {"error": "The file is not an image."}
|
23 |
return await funciones.crea_babydoll(image, outfit_color)
|
|
|
25 |
@app.post("/leather/")
|
26 |
async def leather(
|
27 |
image: UploadFile = File(...),
|
28 |
+
#outfit_color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
29 |
+
):
|
30 |
if not image.content_type.startswith("image/"):
|
31 |
return {"error": "The file is not an image."}
|
32 |
+
return await funciones.crea_leather(image)
|
33 |
|
34 |
@app.post("/stewardess/")
|
35 |
async def stewardess(
|
|
|
37 |
color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)):
|
38 |
if not image.content_type.startswith("image/"):
|
39 |
return {"error": "The file is not an image."}
|
40 |
+
return await funciones.crea_stewardess(image, color)
|
41 |
+
|
42 |
+
@app.post("/oktoberfest/")
|
43 |
+
async def oktoberfest(
|
44 |
+
image: UploadFile = File(...),
|
45 |
+
#color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
46 |
+
):
|
47 |
+
if not image.content_type.startswith("image/"):
|
48 |
+
return {"error": "The file is not an image."}
|
49 |
+
return await funciones.crea_oktoberfest(image)
|
50 |
+
|
51 |
+
@app.post("/ghibli/")
|
52 |
+
async def ghibli(
|
53 |
+
image: UploadFile = File(...),
|
54 |
+
#color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
|
55 |
+
):
|
56 |
+
if not image.content_type.startswith("image/"):
|
57 |
+
return {"error": "The file is not an image."}
|
58 |
+
return await funciones.crea_ghibli(image)
|
funciones.py
CHANGED
@@ -32,10 +32,10 @@ async def crea_babydoll(image, outfit_color):
|
|
32 |
print(f"Error: {e}")
|
33 |
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
34 |
|
35 |
-
async def crea_leather(image
|
36 |
endpoint = 'leather'
|
37 |
try:
|
38 |
-
prompt = databank.obtenPrompt(endpoint
|
39 |
resultado = await herramientas.exeCute(endpoint, image, prompt)
|
40 |
if type(resultado) is str:
|
41 |
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
@@ -54,6 +54,32 @@ async def crea_stewardess(image, outfit_color):
|
|
54 |
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
55 |
elif type(resultado) is dict:
|
56 |
return resultado
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
except Exception as e:
|
58 |
print(f"Error: {e}")
|
59 |
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
|
|
32 |
print(f"Error: {e}")
|
33 |
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
34 |
|
35 |
+
async def crea_leather(image):
|
36 |
endpoint = 'leather'
|
37 |
try:
|
38 |
+
prompt = databank.obtenPrompt(endpoint)
|
39 |
resultado = await herramientas.exeCute(endpoint, image, prompt)
|
40 |
if type(resultado) is str:
|
41 |
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
|
|
54 |
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
55 |
elif type(resultado) is dict:
|
56 |
return resultado
|
57 |
+
except Exception as e:
|
58 |
+
print(f"Error: {e}")
|
59 |
+
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
60 |
+
|
61 |
+
async def crea_oktoberfest(image):
|
62 |
+
endpoint = 'oktoberfest'
|
63 |
+
try:
|
64 |
+
prompt = databank.obtenPrompt(endpoint)
|
65 |
+
resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
|
66 |
+
if type(resultado) is str:
|
67 |
+
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
68 |
+
elif type(resultado) is dict:
|
69 |
+
return resultado
|
70 |
+
except Exception as e:
|
71 |
+
print(f"Error: {e}")
|
72 |
+
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
73 |
+
|
74 |
+
async def crea_ghibli(image):
|
75 |
+
endpoint = 'ghibli'
|
76 |
+
try:
|
77 |
+
prompt = databank.obtenPrompt(endpoint)
|
78 |
+
resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
|
79 |
+
if type(resultado) is str:
|
80 |
+
return FileResponse(resultado, media_type="image/jpg", filename=f"{endpoint}-{timestamp_segundos}.jpg")
|
81 |
+
elif type(resultado) is dict:
|
82 |
+
return resultado
|
83 |
except Exception as e:
|
84 |
print(f"Error: {e}")
|
85 |
return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
|
herramientas.py
CHANGED
@@ -67,8 +67,10 @@ def getPosition(carpeta_positions):
|
|
67 |
Returns:
|
68 |
bool: True si se guardó el archivo correctamente.
|
69 |
"""
|
70 |
-
|
71 |
ruta_carpeta = os.path.join("images", "positions", carpeta_positions)
|
|
|
|
|
72 |
|
73 |
try:
|
74 |
lista_archivos = os.listdir(ruta_carpeta)
|
|
|
67 |
Returns:
|
68 |
bool: True si se guardó el archivo correctamente.
|
69 |
"""
|
70 |
+
#Con carpeta específica.
|
71 |
ruta_carpeta = os.path.join("images", "positions", carpeta_positions)
|
72 |
+
#O una carpeta específica para todas.
|
73 |
+
ruta_carpeta = os.path.join("images", "positions", "all")
|
74 |
|
75 |
try:
|
76 |
lista_archivos = os.listdir(ruta_carpeta)
|
images/positions/all/Aquaman'sMera-1740943688.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/AwesomeCreature.webp
ADDED
![]() |
Git LFS Details
|
images/positions/all/Batgirl-1740939359.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Batgirl-1741071349.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Batgirl-1741158100.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/BlackWidow-1742080636.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/CaptainMarvel-1740939730.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/CaptainMarvel-1741158610.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/CaptainMarvel-1741210153.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/CaptainMarvel-1741213160.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Catwoman-1740940080.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Cohen.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/DC'sMera-1740943597.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Daredevil'sElektraNatchioswithtrinche-1740954016.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Desprop-Mera-1740944858.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Elektra-1740950075.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/ElektraNatchioswithkatana-1740951946.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Elektrawithcarvingfork.-1740954744.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Elektrawithkatana-1741156530.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Elektrawithsaiweapon.-1740956768.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/HarleyQuinn-1741202158.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/HarleyQuinn-1742088853.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/HumanTorch-1741213379.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Maresa-WonderWoman-1740940866.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Marvel's Domino-1740365393.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Marvel'sJeanGrey-1740369341.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1740943342.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1740944411.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1740944510.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1741072395.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1741202477.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Mera-1741209845.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Powergirl-1742090886.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/ScarletWitch-1741158288.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/ScarletWitch-1741201818.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/Slim-ScarletWitch-1741156364.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/SuperheroineOzymandias.webp
ADDED
![]() |
Git LFS Details
|
images/positions/all/TheWasp-1741813091.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/WhiteQueenEmmaFrost-1742091060.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenArchangel-1740982650.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenArchangelwithwingsspread-1741061925.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenArchangelwithwingsspread-1741061971.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenBeast-1740983870.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenIceman-1740982180.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenIceman-1740982247.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenJeanGrey-1740881140.jpg
ADDED
![]() |
Git LFS Details
|
images/positions/all/XmenNightcrawler-1740983415.jpg
ADDED
![]() |
Git LFS Details
|