Moibe commited on
Commit
913877b
·
1 Parent(s): a3d7f6f

Perfeccionados winner prompts

Browse files
app.py CHANGED
@@ -10,7 +10,7 @@ app = FastAPI()
10
  @app.post("/partynight/")
11
  async def partynight(
12
  image: UploadFile = File(...),
13
- 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)
14
  ):
15
  if not image.content_type.startswith("image/"):
16
  return {"error": "The file is not an image."}
@@ -19,7 +19,7 @@ async def partynight(
19
  @app.post("/babydoll/")
20
  async def babydoll(
21
  image: UploadFile = File(...),
22
- 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)
23
  ):
24
  if not image.content_type.startswith("image/"):
25
  return {"error": "The file is not an image."}
@@ -27,8 +27,7 @@ async def babydoll(
27
 
28
  @app.post("/leather/")
29
  async def leather(
30
- image: UploadFile = File(...),
31
- #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)
32
  ):
33
  if not image.content_type.startswith("image/"):
34
  return {"error": "The file is not an image."}
@@ -37,15 +36,14 @@ async def leather(
37
  @app.post("/stewardess/")
38
  async def stewardess(
39
  image: UploadFile = File(...),
40
- color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)):
41
  if not image.content_type.startswith("image/"):
42
  return {"error": "The file is not an image."}
43
  return await funciones.crea_stewardess(image, color)
44
 
45
  @app.post("/oktoberfest/")
46
  async def oktoberfest(
47
- image: UploadFile = File(...),
48
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
49
  ):
50
  if not image.content_type.startswith("image/"):
51
  return {"error": "The file is not an image."}
@@ -53,8 +51,7 @@ async def oktoberfest(
53
 
54
  @app.post("/ghibli/")
55
  async def ghibli(
56
- image: UploadFile = File(...),
57
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
58
  ):
59
  if not image.content_type.startswith("image/"):
60
  return {"error": "The file is not an image."}
@@ -62,8 +59,7 @@ async def ghibli(
62
 
63
  @app.post("/wildwest/")
64
  async def wildwest(
65
- image: UploadFile = File(...),
66
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
67
  ):
68
  if not image.content_type.startswith("image/"):
69
  return {"error": "The file is not an image."}
@@ -71,8 +67,7 @@ async def wildwest(
71
 
72
  @app.post("/bride/")
73
  async def bride(
74
- image: UploadFile = File(...),
75
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
76
  ):
77
  if not image.content_type.startswith("image/"):
78
  return {"error": "The file is not an image."}
@@ -81,7 +76,7 @@ async def bride(
81
  @app.post("/swimsuit/")
82
  async def swimsuit(
83
  image: UploadFile = File(...),
84
- color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
85
  ):
86
  if not image.content_type.startswith("image/"):
87
  return {"error": "The file is not an image."}
@@ -89,8 +84,7 @@ async def swimsuit(
89
 
90
  @app.post("/lingerie/")
91
  async def lingerie(
92
- image: UploadFile = File(...),
93
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
94
  ):
95
  if not image.content_type.startswith("image/"):
96
  return {"error": "The file is not an image."}
@@ -98,8 +92,7 @@ async def lingerie(
98
 
99
  @app.post("/schooluniform/")
100
  async def schooluniform(
101
- image: UploadFile = File(...),
102
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
103
  ):
104
  if not image.content_type.startswith("image/"):
105
  return {"error": "The file is not an image."}
@@ -107,8 +100,7 @@ async def schooluniform(
107
 
108
  @app.post("/frenchmaid/")
109
  async def frenchmaid(
110
- image: UploadFile = File(...),
111
- #color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
112
  ):
113
  if not image.content_type.startswith("image/"):
114
  return {"error": "The file is not an image."}
@@ -117,8 +109,8 @@ async def frenchmaid(
117
  @app.post("/cheerleader/")
118
  async def cheerleader(
119
  image: UploadFile = File(...),
120
- color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "blue sky", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None),
121
- hairstyle: Literal["ponytail", "pigtails", ""] = Form(None)
122
  ):
123
  if not image.content_type.startswith("image/"):
124
  return {"error": "The file is not an image."}
 
10
  @app.post("/partynight/")
11
  async def partynight(
12
  image: UploadFile = File(...),
13
+ 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)
14
  ):
15
  if not image.content_type.startswith("image/"):
16
  return {"error": "The file is not an image."}
 
19
  @app.post("/babydoll/")
20
  async def babydoll(
21
  image: UploadFile = File(...),
22
+ 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)
23
  ):
24
  if not image.content_type.startswith("image/"):
25
  return {"error": "The file is not an image."}
 
27
 
28
  @app.post("/leather/")
29
  async def leather(
30
+ image: UploadFile = File(...)
 
31
  ):
32
  if not image.content_type.startswith("image/"):
33
  return {"error": "The file is not an image."}
 
36
  @app.post("/stewardess/")
37
  async def stewardess(
38
  image: UploadFile = File(...),
39
+ color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)):
40
  if not image.content_type.startswith("image/"):
41
  return {"error": "The file is not an image."}
42
  return await funciones.crea_stewardess(image, color)
43
 
44
  @app.post("/oktoberfest/")
45
  async def oktoberfest(
46
+ image: UploadFile = File(...)
 
47
  ):
48
  if not image.content_type.startswith("image/"):
49
  return {"error": "The file is not an image."}
 
51
 
52
  @app.post("/ghibli/")
53
  async def ghibli(
54
+ image: UploadFile = File(...)
 
55
  ):
56
  if not image.content_type.startswith("image/"):
57
  return {"error": "The file is not an image."}
 
59
 
60
  @app.post("/wildwest/")
61
  async def wildwest(
62
+ image: UploadFile = File(...)
 
63
  ):
64
  if not image.content_type.startswith("image/"):
65
  return {"error": "The file is not an image."}
 
67
 
68
  @app.post("/bride/")
69
  async def bride(
70
+ image: UploadFile = File(...)
 
71
  ):
72
  if not image.content_type.startswith("image/"):
73
  return {"error": "The file is not an image."}
 
76
  @app.post("/swimsuit/")
77
  async def swimsuit(
78
  image: UploadFile = File(...),
79
+ color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None)
80
  ):
81
  if not image.content_type.startswith("image/"):
82
  return {"error": "The file is not an image."}
 
84
 
85
  @app.post("/lingerie/")
86
  async def lingerie(
87
+ image: UploadFile = File(...)
 
88
  ):
89
  if not image.content_type.startswith("image/"):
90
  return {"error": "The file is not an image."}
 
92
 
93
  @app.post("/schooluniform/")
94
  async def schooluniform(
95
+ image: UploadFile = File(...)
 
96
  ):
97
  if not image.content_type.startswith("image/"):
98
  return {"error": "The file is not an image."}
 
100
 
101
  @app.post("/frenchmaid/")
102
  async def frenchmaid(
103
+ image: UploadFile = File(...)
 
104
  ):
105
  if not image.content_type.startswith("image/"):
106
  return {"error": "The file is not an image."}
 
109
  @app.post("/cheerleader/")
110
  async def cheerleader(
111
  image: UploadFile = File(...),
112
+ color: Literal["red", "black", "blue", "golden", "pink", "green", "yellow", "purple", "silver", "white", "sky blue", "light blue", "royal blue", "navy blue", "orange", "random", ""] = Form(None),
113
+ hairstyle: Literal["ponytail", "pigtails", "random", ""] = Form(None)
114
  ):
115
  if not image.content_type.startswith("image/"):
116
  return {"error": "The file is not an image."}
catalogo.py CHANGED
@@ -1,2 +1,2 @@
1
- colores = ["green", "red", "golden", "blue", "pink", "yellow", "black", "silver", "white", "purple", "blue sky", "navy blue", "orange", "random"]
2
  accesorios_stewardess = ['beret', 'cap', 'pillbox hat', '']
 
1
+ colores = ["green", "red", "golden", "blue", "pink", "yellow", "black", "silver", "white", "purple", "sky blue", "navy blue", "orange"]
2
  accesorios_stewardess = ['beret', 'cap', 'pillbox hat', '']
databank.py CHANGED
@@ -19,7 +19,7 @@ def obtenPrompt(endpoint, **kwargs): #Son opcionales todos los demás argumentos
19
  elif endpoint == "wildwest":
20
  return f"A Ghibli manga of a beautiful wild west girl with a poncho, a revolver and bullets bandolier"
21
  elif endpoint == "stewardess":
22
- return f"A Ghibli manga of a beautiful flight attendant in a {outfit_color} uniform skirt with a {obtenAccesorio('stewardess')}"
23
  elif endpoint == "bride":
24
  return f"A {defineEstilo('bride')} art nouveau of a beautiful bride in a spectacular wedding dress"
25
  elif endpoint == "swimsuit":
@@ -31,7 +31,7 @@ def obtenPrompt(endpoint, **kwargs): #Son opcionales todos los demás argumentos
31
  elif endpoint == "frenchmaid":
32
  return f"A manga picture of a girl in french maid uniform with maid's tiara"
33
  elif endpoint == "cheerleader":
34
- return f"A manga picture of a cheerleader with {outfit_color} uniform and {hair_style}"
35
 
36
  def obtenAccesorio(endpoint):
37
 
@@ -48,7 +48,13 @@ def obtenAccesorio(endpoint):
48
  elif endpoint == "wildwest":
49
  return
50
  elif endpoint == "stewardess":
51
- return random.choice(catalogo.colores) + ' ' + random.choice(catalogo.accesorios_stewardess)
 
 
 
 
 
 
52
  elif endpoint == "bride":
53
  return
54
  elif endpoint == "swimsuit":
@@ -92,7 +98,4 @@ def defineEstilo(endpoint):
92
  return
93
  elif endpoint == "cheerleader":
94
  return
95
- return random.choice(catalogo.estilo)
96
-
97
-
98
-
 
19
  elif endpoint == "wildwest":
20
  return f"A Ghibli manga of a beautiful wild west girl with a poncho, a revolver and bullets bandolier"
21
  elif endpoint == "stewardess":
22
+ return f"A Ghibli manga of a beautiful flight attendant in a {outfit_color} uniform skirt {obtenAccesorio('stewardess')}"
23
  elif endpoint == "bride":
24
  return f"A {defineEstilo('bride')} art nouveau of a beautiful bride in a spectacular wedding dress"
25
  elif endpoint == "swimsuit":
 
31
  elif endpoint == "frenchmaid":
32
  return f"A manga picture of a girl in french maid uniform with maid's tiara"
33
  elif endpoint == "cheerleader":
34
+ return f"A manga picture of a cheerleader with {outfit_color} uniform and {hair_style} hair style."
35
 
36
  def obtenAccesorio(endpoint):
37
 
 
48
  elif endpoint == "wildwest":
49
  return
50
  elif endpoint == "stewardess":
51
+ accesorio = random.choice(catalogo.accesorios_stewardess)
52
+ if accesorio !='':
53
+ print("Si hay accesorio...")
54
+ return 'with a ' + random.choice(catalogo.colores) + ' ' + accesorio
55
+ else:
56
+ return ''
57
+
58
  elif endpoint == "bride":
59
  return
60
  elif endpoint == "swimsuit":
 
98
  return
99
  elif endpoint == "cheerleader":
100
  return
101
+ return random.choice(catalogo.estilo)
 
 
 
funciones.py CHANGED
@@ -7,9 +7,10 @@ async def crea_partynight(image, outfit_color):
7
  endpoint = 'partynight'
8
  try:
9
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color) #Van a tener que ser kwargs porque variará de lo recibido de ep a ep.
 
10
  resultado = await herramientas.exeCute(endpoint, image, prompt)
11
  if type(resultado) is str:
12
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
13
  elif type(resultado) is dict:
14
  return resultado
15
  except Exception as e:
@@ -20,9 +21,10 @@ async def crea_babydoll(image, outfit_color):
20
  endpoint = 'babydoll'
21
  try:
22
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
 
23
  resultado = await herramientas.exeCute(endpoint, image, prompt)
24
  if type(resultado) is str:
25
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
26
  elif type(resultado) is dict:
27
  return resultado
28
  except Exception as e:
@@ -36,7 +38,7 @@ async def crea_leather(image):
36
  print("Prompt final: ", prompt)
37
  resultado = await herramientas.exeCute(endpoint, image, prompt)
38
  if type(resultado) is str:
39
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
40
  elif type(resultado) is dict:
41
  return resultado
42
  except Exception as e:
@@ -47,9 +49,10 @@ async def crea_stewardess(image, outfit_color):
47
  endpoint = 'stewardess'
48
  try:
49
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
 
50
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
51
  if type(resultado) is str:
52
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
53
  elif type(resultado) is dict:
54
  return resultado
55
  except Exception as e:
@@ -60,9 +63,10 @@ async def crea_oktoberfest(image):
60
  endpoint = 'oktoberfest'
61
  try:
62
  prompt = databank.obtenPrompt(endpoint)
 
63
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
64
  if type(resultado) is str:
65
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
66
  elif type(resultado) is dict:
67
  return resultado
68
  except Exception as e:
@@ -73,9 +77,10 @@ async def crea_ghibli(image):
73
  endpoint = 'ghibli'
74
  try:
75
  prompt = databank.obtenPrompt(endpoint)
 
76
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
77
  if type(resultado) is str:
78
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
79
  elif type(resultado) is dict:
80
  return resultado
81
  except Exception as e:
@@ -86,9 +91,10 @@ async def crea_wildwest(image):
86
  endpoint = 'wildwest'
87
  try:
88
  prompt = databank.obtenPrompt(endpoint)
 
89
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
90
  if type(resultado) is str:
91
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
92
  elif type(resultado) is dict:
93
  return resultado
94
  except Exception as e:
@@ -99,9 +105,10 @@ async def crea_bride(image):
99
  endpoint = 'bride'
100
  try:
101
  prompt = databank.obtenPrompt(endpoint)
 
102
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
103
  if type(resultado) is str:
104
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
105
  elif type(resultado) is dict:
106
  return resultado
107
  except Exception as e:
@@ -112,9 +119,10 @@ async def crea_swimsuit(image, outfit_color):
112
  endpoint = 'swimsuit'
113
  try:
114
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
 
115
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
116
  if type(resultado) is str:
117
- return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
118
  elif type(resultado) is dict:
119
  return resultado
120
  except Exception as e:
@@ -125,6 +133,7 @@ async def crea_lingerie(image):
125
  endpoint = 'lingerie'
126
  try:
127
  prompt = databank.obtenPrompt(endpoint)
 
128
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
129
  if type(resultado) is str:
130
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
@@ -138,6 +147,7 @@ async def crea_schooluniform(image):
138
  endpoint = 'schooluniform'
139
  try:
140
  prompt = databank.obtenPrompt(endpoint)
 
141
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
142
  if type(resultado) is str:
143
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
@@ -151,6 +161,7 @@ async def crea_frenchmaid(image):
151
  endpoint = 'frenchmaid'
152
  try:
153
  prompt = databank.obtenPrompt(endpoint)
 
154
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
155
  if type(resultado) is str:
156
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
@@ -164,6 +175,7 @@ async def crea_cheerleader(image, color, hairstyle):
164
  endpoint = 'cheerleader'
165
  try:
166
  prompt = databank.obtenPrompt(endpoint, outfit_color=color, hair_style = hairstyle)
 
167
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
168
  if type(resultado) is str:
169
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
@@ -171,6 +183,4 @@ async def crea_cheerleader(image, color, hairstyle):
171
  return resultado
172
  except Exception as e:
173
  print(f"Error: {e}")
174
- return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
175
-
176
-
 
7
  endpoint = 'partynight'
8
  try:
9
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color) #Van a tener que ser kwargs porque variará de lo recibido de ep a ep.
10
+ print(prompt)
11
  resultado = await herramientas.exeCute(endpoint, image, prompt)
12
  if type(resultado) is str:
13
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint)) #Usa el prompt como nombre en dev para info más rica, endpoint para usuario final.
14
  elif type(resultado) is dict:
15
  return resultado
16
  except Exception as e:
 
21
  endpoint = 'babydoll'
22
  try:
23
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
24
+ print(prompt)
25
  resultado = await herramientas.exeCute(endpoint, image, prompt)
26
  if type(resultado) is str:
27
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
28
  elif type(resultado) is dict:
29
  return resultado
30
  except Exception as e:
 
38
  print("Prompt final: ", prompt)
39
  resultado = await herramientas.exeCute(endpoint, image, prompt)
40
  if type(resultado) is str:
41
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
42
  elif type(resultado) is dict:
43
  return resultado
44
  except Exception as e:
 
49
  endpoint = 'stewardess'
50
  try:
51
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
52
+ print(prompt)
53
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
54
  if type(resultado) is str:
55
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
56
  elif type(resultado) is dict:
57
  return resultado
58
  except Exception as e:
 
63
  endpoint = 'oktoberfest'
64
  try:
65
  prompt = databank.obtenPrompt(endpoint)
66
+ print(prompt)
67
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
68
  if type(resultado) is str:
69
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
70
  elif type(resultado) is dict:
71
  return resultado
72
  except Exception as e:
 
77
  endpoint = 'ghibli'
78
  try:
79
  prompt = databank.obtenPrompt(endpoint)
80
+ print(prompt)
81
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
82
  if type(resultado) is str:
83
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
84
  elif type(resultado) is dict:
85
  return resultado
86
  except Exception as e:
 
91
  endpoint = 'wildwest'
92
  try:
93
  prompt = databank.obtenPrompt(endpoint)
94
+ print(prompt)
95
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
96
  if type(resultado) is str:
97
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
98
  elif type(resultado) is dict:
99
  return resultado
100
  except Exception as e:
 
105
  endpoint = 'bride'
106
  try:
107
  prompt = databank.obtenPrompt(endpoint)
108
+ print(prompt)
109
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
110
  if type(resultado) is str:
111
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
112
  elif type(resultado) is dict:
113
  return resultado
114
  except Exception as e:
 
119
  endpoint = 'swimsuit'
120
  try:
121
  prompt = databank.obtenPrompt(endpoint, outfit_color=outfit_color)
122
+ print(prompt)
123
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
124
  if type(resultado) is str:
125
+ return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(endpoint))
126
  elif type(resultado) is dict:
127
  return resultado
128
  except Exception as e:
 
133
  endpoint = 'lingerie'
134
  try:
135
  prompt = databank.obtenPrompt(endpoint)
136
+ print(prompt)
137
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
138
  if type(resultado) is str:
139
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
 
147
  endpoint = 'schooluniform'
148
  try:
149
  prompt = databank.obtenPrompt(endpoint)
150
+ print(prompt)
151
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
152
  if type(resultado) is str:
153
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
 
161
  endpoint = 'frenchmaid'
162
  try:
163
  prompt = databank.obtenPrompt(endpoint)
164
+ print(prompt)
165
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
166
  if type(resultado) is str:
167
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
 
175
  endpoint = 'cheerleader'
176
  try:
177
  prompt = databank.obtenPrompt(endpoint, outfit_color=color, hair_style = hairstyle)
178
+ print(prompt)
179
  resultado = await herramientas.exeCute(endpoint, image, prompt) #execute ya debe recibir prompt hecho.
180
  if type(resultado) is str:
181
  return FileResponse(resultado, media_type="image/jpg", filename=herramientas.formaFilename(prompt))
 
183
  return resultado
184
  except Exception as e:
185
  print(f"Error: {e}")
186
+ return {"error": "Unable to detect a face in the image. Please upload a different photo with a clear face."}
 
 
herramientas.py CHANGED
@@ -82,9 +82,7 @@ def getPosition(carpeta_positions):
82
  print("No hay carpeta de posiciones:", e)
83
  return e
84
 
85
- async def exeCute(endpoint, image, prompt):
86
-
87
- print(prompt)
88
 
89
  temp_image = await imageToTemp(image)
90
  try:
@@ -133,9 +131,4 @@ def formaFilename(prompt):
133
  timestamp_segundos = int(time.time())
134
  print(f"Printed at: {timestamp_segundos}.")
135
 
136
- return f"{prompt}-{timestamp_segundos}.jpg"
137
-
138
-
139
-
140
-
141
-
 
82
  print("No hay carpeta de posiciones:", e)
83
  return e
84
 
85
+ async def exeCute(endpoint, image, prompt):
 
 
86
 
87
  temp_image = await imageToTemp(image)
88
  try:
 
131
  timestamp_segundos = int(time.time())
132
  print(f"Printed at: {timestamp_segundos}.")
133
 
134
+ return f"{prompt}-{timestamp_segundos}.jpg"
 
 
 
 
 
images/positions/all/{CaptainMarvel-1741210153.jpg → Ana.png} RENAMED
File without changes
images/positions/all/a9ea7322-7619-4dda-a2c3-c42c74870fde.jpg ADDED

Git LFS Details

  • SHA256: 8a54eba86f852f8e2e9c758945f4ff278b837b8e7494fec898e41df4c690578b
  • Pointer size: 130 Bytes
  • Size of remote file: 21.3 kB
images/positions/all/image.webp ADDED

Git LFS Details

  • SHA256: 55f4719cf541904c4472dc8c8a13fd0c20184fddd56ee72f5ddd3c014e4fba0f
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB