update response text2img
Browse files- api/core/app.py +1 -1
- api/main.py +2 -1
api/core/app.py
CHANGED
@@ -73,7 +73,7 @@ class Demos:
|
|
73 |
_resumen = Abstractor.resumen(texto=texto)
|
74 |
return _resumen
|
75 |
@staticmethod
|
76 |
-
def text_to_img(texto:str=None, model:str="PROMPTHERO")->
|
77 |
"""Genera un BITARRAY de la imagen con el texto dado.
|
78 |
|
79 |
args:
|
|
|
73 |
_resumen = Abstractor.resumen(texto=texto)
|
74 |
return _resumen
|
75 |
@staticmethod
|
76 |
+
def text_to_img(texto:str=None, model:str="PROMPTHERO")->bytes|None:
|
77 |
"""Genera un BITARRAY de la imagen con el texto dado.
|
78 |
|
79 |
args:
|
api/main.py
CHANGED
@@ -90,6 +90,7 @@ def get_text2img(data:dict) -> dict:
|
|
90 |
__response['original']= data.get('texto')
|
91 |
__response['image']= __main.text_to_img(texto=data.get('texto'),
|
92 |
model=data.get('modelo'))
|
|
|
93 |
else:
|
94 |
raise __main.exception(status_code = 401, datail=f"Datos mal formados:\n{data}")
|
95 |
except Exception as e:
|
@@ -97,7 +98,7 @@ def get_text2img(data:dict) -> dict:
|
|
97 |
#To-do ->agregar mas información en el error fecha, usuario, reqs
|
98 |
raise __main.exception(status_code = 403, datail=e)
|
99 |
finally:
|
100 |
-
return
|
101 |
|
102 |
@api.post("/texto_a_video/", status_code=201)
|
103 |
def get_text2video(data:dict) -> dict:
|
|
|
90 |
__response['original']= data.get('texto')
|
91 |
__response['image']= __main.text_to_img(texto=data.get('texto'),
|
92 |
model=data.get('modelo'))
|
93 |
+
__r = __main.api_response(content=__response, media_type="image/png")
|
94 |
else:
|
95 |
raise __main.exception(status_code = 401, datail=f"Datos mal formados:\n{data}")
|
96 |
except Exception as e:
|
|
|
98 |
#To-do ->agregar mas información en el error fecha, usuario, reqs
|
99 |
raise __main.exception(status_code = 403, datail=e)
|
100 |
finally:
|
101 |
+
return __r
|
102 |
|
103 |
@api.post("/texto_a_video/", status_code=201)
|
104 |
def get_text2video(data:dict) -> dict:
|