Spaces:
Running
Running
Prints edit
Browse files- app.py +2 -2
- funciones.py +2 -3
- herramientas.py +8 -13
app.py
CHANGED
@@ -36,7 +36,7 @@ async def genera_imagen(platillo: str = Form(...)):
|
|
36 |
print(herramientas.imprimeTimeNow())
|
37 |
|
38 |
if seconds_available > globales.work_cost:
|
39 |
-
print("Usando
|
40 |
resultado = funciones.genera_platillo_gpu(platillo)
|
41 |
if "Error" in resultado:
|
42 |
return resultado
|
@@ -44,7 +44,7 @@ async def genera_imagen(platillo: str = Form(...)):
|
|
44 |
return FileResponse(resultado, media_type="image/png", filename="imagen.png")
|
45 |
else:
|
46 |
|
47 |
-
print("Usando Inference
|
48 |
resultado = funciones.genera_platillo_inference(platillo)
|
49 |
print("El resultado de inference es: ", resultado)
|
50 |
if type(resultado) is str:
|
|
|
36 |
print(herramientas.imprimeTimeNow())
|
37 |
|
38 |
if seconds_available > globales.work_cost:
|
39 |
+
print("Usando ZeroGPU 🪭.")
|
40 |
resultado = funciones.genera_platillo_gpu(platillo)
|
41 |
if "Error" in resultado:
|
42 |
return resultado
|
|
|
44 |
return FileResponse(resultado, media_type="image/png", filename="imagen.png")
|
45 |
else:
|
46 |
|
47 |
+
print("Usando Inference ✨.")
|
48 |
resultado = funciones.genera_platillo_inference(platillo)
|
49 |
print("El resultado de inference es: ", resultado)
|
50 |
if type(resultado) is str:
|
funciones.py
CHANGED
@@ -14,8 +14,7 @@ servidor = globales.servidor
|
|
14 |
def genera_platillo_gpu(platillo):
|
15 |
|
16 |
prompt = globales.previo + platillo
|
17 |
-
|
18 |
-
|
19 |
try:
|
20 |
|
21 |
dict_espacios = conexion_firebase.obtenDato('nowme', servidor, 'espacios')
|
@@ -100,7 +99,7 @@ def genera_platillo_inference(platillo):
|
|
100 |
#negative_prompt="live animals",
|
101 |
width=784, #786
|
102 |
height=560, #568
|
103 |
-
num_inference_steps=
|
104 |
)
|
105 |
|
106 |
#Detenido momentaneamente por cambio a firebase.
|
|
|
14 |
def genera_platillo_gpu(platillo):
|
15 |
|
16 |
prompt = globales.previo + platillo
|
17 |
+
|
|
|
18 |
try:
|
19 |
|
20 |
dict_espacios = conexion_firebase.obtenDato('nowme', servidor, 'espacios')
|
|
|
99 |
#negative_prompt="live animals",
|
100 |
width=784, #786
|
101 |
height=560, #568
|
102 |
+
num_inference_steps=12
|
103 |
)
|
104 |
|
105 |
#Detenido momentaneamente por cambio a firebase.
|
herramientas.py
CHANGED
@@ -51,7 +51,7 @@ def restaSegundosGPU(cuantos_segundos):
|
|
51 |
|
52 |
# Restar los segundos
|
53 |
nuevos_segundos_disponibles = segundos_disponibles - cuantos_segundos
|
54 |
-
print("
|
55 |
conexion_firebase.editaDato('nowme', servidor, 'segundos', nuevos_segundos_disponibles)
|
56 |
|
57 |
def restaSegundosInference(cuantos_segundos):
|
@@ -64,7 +64,7 @@ def restaSegundosInference(cuantos_segundos):
|
|
64 |
|
65 |
# Restar los segundos
|
66 |
nuevos_segundos_disponibles = segundos_disponibles - cuantos_segundos
|
67 |
-
print("
|
68 |
conexion_firebase.editaDato('nowme', servidor, 'inferencias', nuevos_segundos_disponibles)
|
69 |
|
70 |
def modificaModeloActual(nuevo_modelo):
|
@@ -100,8 +100,7 @@ def siEsDiaSiguienteRenueva():
|
|
100 |
|
101 |
#Obtiene el último registro de fecha de la base de firestore.
|
102 |
fecha_registro_dt = obtenUltimoTimestamp()
|
103 |
-
|
104 |
-
|
105 |
#Timestamp actual
|
106 |
fecha_actual_dt = imprimeTimeNow()
|
107 |
|
@@ -124,19 +123,15 @@ def siEsDiaSiguienteRenueva():
|
|
124 |
renuevaTimestampActual()
|
125 |
else: #Si la diferencia es de un solo día entonces si debe checar si ya rebaso la hora de renovación del servidor.
|
126 |
hora_actual = datetime_obj_2.time()
|
127 |
-
|
128 |
-
|
129 |
-
print("Tipo hora_actual: ", type(hora_actual.hour))
|
130 |
-
print("Tipo global hora renovación: ", type(globales.hora_renovacion))
|
131 |
-
|
132 |
-
if int(hora_actual.hour) > int(globales.hora_renovacion):
|
133 |
-
|
134 |
print("Renovando segundos.")
|
135 |
renuevaSegundosDisponibles()
|
136 |
renuevaTimestampActual()
|
137 |
else:
|
138 |
-
print("
|
|
|
139 |
else:
|
140 |
-
print("
|
141 |
|
142 |
return resultado
|
|
|
51 |
|
52 |
# Restar los segundos
|
53 |
nuevos_segundos_disponibles = segundos_disponibles - cuantos_segundos
|
54 |
+
print("Procesado, segundos disponibles ahora: ", nuevos_segundos_disponibles)
|
55 |
conexion_firebase.editaDato('nowme', servidor, 'segundos', nuevos_segundos_disponibles)
|
56 |
|
57 |
def restaSegundosInference(cuantos_segundos):
|
|
|
64 |
|
65 |
# Restar los segundos
|
66 |
nuevos_segundos_disponibles = segundos_disponibles - cuantos_segundos
|
67 |
+
print("Procesado, segundos disponibles ahora: ", nuevos_segundos_disponibles)
|
68 |
conexion_firebase.editaDato('nowme', servidor, 'inferencias', nuevos_segundos_disponibles)
|
69 |
|
70 |
def modificaModeloActual(nuevo_modelo):
|
|
|
100 |
|
101 |
#Obtiene el último registro de fecha de la base de firestore.
|
102 |
fecha_registro_dt = obtenUltimoTimestamp()
|
103 |
+
|
|
|
104 |
#Timestamp actual
|
105 |
fecha_actual_dt = imprimeTimeNow()
|
106 |
|
|
|
123 |
renuevaTimestampActual()
|
124 |
else: #Si la diferencia es de un solo día entonces si debe checar si ya rebaso la hora de renovación del servidor.
|
125 |
hora_actual = datetime_obj_2.time()
|
126 |
+
|
127 |
+
if int(hora_actual.hour) > int(globales.hora_renovacion):
|
|
|
|
|
|
|
|
|
|
|
128 |
print("Renovando segundos.")
|
129 |
renuevaSegundosDisponibles()
|
130 |
renuevaTimestampActual()
|
131 |
else:
|
132 |
+
print("Aún no hay renovación de capa de procesamiento.")
|
133 |
+
pass
|
134 |
else:
|
135 |
+
print("Aún no hay renovación de capa de procesamiento.")
|
136 |
|
137 |
return resultado
|