Moibe commited on
Commit
afb0579
·
1 Parent(s): c07429b

Firestore restored

Browse files
Files changed (4) hide show
  1. .gitignore +2 -1
  2. app.py +5 -10
  3. funciones.py +7 -8
  4. herramientas.py +0 -1
.gitignore CHANGED
@@ -2,4 +2,5 @@
2
  /__pycache__/
3
  bridges.py
4
  config.json
5
- config_old.json
 
 
2
  /__pycache__/
3
  bridges.py
4
  config.json
5
+ config_local.json
6
+ config_old.json
app.py CHANGED
@@ -32,12 +32,9 @@ async def echo_image(image: UploadFile = File(...)):
32
  @app.post("/genera-imagen/")
33
  async def genera_imagen(platillo: str = Form(...)):
34
 
35
- #Obtengo los segundos disponibles de procesamiento para saber si tengo GPU disponible de la capa gratuita o me voy a método cobrado.
36
-
37
- #Detenido momentaneamente ante el cambio de firebase.
38
- #seconds_available = herramientas.obtenSegundosDisponibles()
39
 
40
- seconds_available = 0
41
 
42
  print(herramientas.imprimeTimeNow())
43
 
@@ -61,11 +58,9 @@ async def genera_imagen(platillo: str = Form(...)):
61
  @app.post("/procesador-lotes/")
62
  async def procesa_lote(platillo: str = Form(...)):
63
 
64
- print("Servicio Secundario de Procesamiento de Lotes")
65
- #Se quita momentaneamente para migración de firebase.
66
- #Obtengo los segundos disponibles de procesamiento para saber si tengo GPU disponible de la capa gratuita o me voy a método cobrado.
67
- #seconds_available = herramientas.obtenSegundosDisponibles()
68
- seconds_available = 0
69
  print(herramientas.imprimeTimeNow())
70
 
71
  if seconds_available > globales.work_cost:
 
32
  @app.post("/genera-imagen/")
33
  async def genera_imagen(platillo: str = Form(...)):
34
 
35
+ seconds_available = herramientas.obtenSegundosDisponibles()
 
 
 
36
 
37
+ #seconds_available = 0
38
 
39
  print(herramientas.imprimeTimeNow())
40
 
 
58
  @app.post("/procesador-lotes/")
59
  async def procesa_lote(platillo: str = Form(...)):
60
 
61
+ print("Servicio Secundario de Procesamiento de Lotes")
62
+ seconds_available = herramientas.obtenSegundosDisponibles()
63
+ #seconds_available = 0
 
 
64
  print(herramientas.imprimeTimeNow())
65
 
66
  if seconds_available > globales.work_cost:
funciones.py CHANGED
@@ -45,18 +45,17 @@ def genera_platillo_gpu(platillo):
45
 
46
  def genera_platillo_inference(platillo):
47
 
48
- #Detenido momentaneamente por cambio a Firebase.
49
- # modelo_actual = conexion_firebase.obtenDato('nowme', 'huggingface', 'modelo_actual')
50
- # modelo = modelo_actual
51
 
52
- modelo = globales.inferencia
53
 
54
  print("Modelo:", modelo)
55
-
56
- #Detenido momentaneamente por cambio a firebase.
57
  #Elegir proveedor de inferencia
58
- #creditos_restantes_inference = conexion_firebase.obtenDato('nowme', 'huggingface', 'hfInference')
59
- creditos_restantes_inference = 5000
60
 
61
  print("Los créditos restantes de hf-inference que tienes son: ", creditos_restantes_inference)
62
  if creditos_restantes_inference > 0:
 
45
 
46
  def genera_platillo_inference(platillo):
47
 
48
+
49
+ modelo_actual = conexion_firebase.obtenDato('nowme', 'huggingface', 'modelo_actual')
50
+ modelo = modelo_actual
51
 
52
+ #modelo = globales.inferencia
53
 
54
  print("Modelo:", modelo)
55
+
 
56
  #Elegir proveedor de inferencia
57
+ creditos_restantes_inference = conexion_firebase.obtenDato('nowme', 'huggingface', 'hfInference')
58
+ #creditos_restantes_inference = 5000
59
 
60
  print("Los créditos restantes de hf-inference que tienes son: ", creditos_restantes_inference)
61
  if creditos_restantes_inference > 0:
herramientas.py CHANGED
@@ -188,7 +188,6 @@ def esDiaSiguiente():
188
  print("Y su tipo es: ", type(fecha_registro_dt))
189
 
190
  #Timestamp actual
191
- #fecha_actual_dt = datetime.fromtimestamp(int(time.time()))
192
  fecha_actual_dt = imprimeTimeNow()
193
  print("Segundo, la fecha_actual_dt quedó como: ", fecha_actual_dt)
194
  print("Y su tipo es: ", type(fecha_actual_dt))
 
188
  print("Y su tipo es: ", type(fecha_registro_dt))
189
 
190
  #Timestamp actual
 
191
  fecha_actual_dt = imprimeTimeNow()
192
  print("Segundo, la fecha_actual_dt quedó como: ", fecha_actual_dt)
193
  print("Y su tipo es: ", type(fecha_actual_dt))