Moibe commited on
Commit
e8b930e
·
1 Parent(s): 5d1c956

Firebaseless

Browse files
Files changed (3) hide show
  1. app.py +9 -2
  2. funciones.py +11 -4
  3. globales.py +1 -1
app.py CHANGED
@@ -33,7 +33,12 @@ async def echo_image(image: UploadFile = File(...)):
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
- seconds_available = herramientas.obtenSegundosDisponibles()
 
 
 
 
 
37
  print(herramientas.imprimeTimeNow())
38
 
39
  if seconds_available > globales.work_cost:
@@ -57,8 +62,10 @@ async def genera_imagen(platillo: str = Form(...)):
57
  async def procesa_lote(platillo: str = Form(...)):
58
 
59
  print("Servicio Secundario de Procesamiento de Lotes")
 
60
  #Obtengo los segundos disponibles de procesamiento para saber si tengo GPU disponible de la capa gratuita o me voy a método cobrado.
61
- seconds_available = herramientas.obtenSegundosDisponibles()
 
62
  print(herramientas.imprimeTimeNow())
63
 
64
  if seconds_available > globales.work_cost:
 
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
 
44
  if seconds_available > globales.work_cost:
 
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:
funciones.py CHANGED
@@ -45,13 +45,19 @@ def genera_platillo_gpu(platillo):
45
 
46
  def genera_platillo_inference(platillo):
47
 
48
- modelo_actual = conexion_firebase.obtenDato('nowme', 'huggingface', 'modelo_actual')
49
- modelo = modelo_actual
 
 
 
50
 
51
  print("Modelo:", modelo)
52
 
 
53
  #Elegir proveedor de inferencia
54
- creditos_restantes_inference = conexion_firebase.obtenDato('nowme', 'huggingface', 'hfInference')
 
 
55
  print("Los créditos restantes de hf-inference que tienes son: ", creditos_restantes_inference)
56
  if creditos_restantes_inference > 0:
57
  provedor_seleccionado = globales.proveedor
@@ -75,7 +81,8 @@ def genera_platillo_inference(platillo):
75
  num_inference_steps=16
76
  )
77
 
78
- herramientas.restaSegundosInference(globales.inference_cost)
 
79
 
80
  except Exception as e:
81
  print("Excepción: ", e)
 
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:
63
  provedor_seleccionado = globales.proveedor
 
81
  num_inference_steps=16
82
  )
83
 
84
+ #Detenido momentaneamente por cambio a firebase.
85
+ #herramientas.restaSegundosInference(globales.inference_cost)
86
 
87
  except Exception as e:
88
  print("Excepción: ", e)
globales.py CHANGED
@@ -6,7 +6,7 @@ previo = "A photograph of a white plate with "
6
  llave, servidor = autenticacion.defineAmbiente()
7
  espacio = "black-forest-labs/FLUX.1-schnell"
8
  #espacio = "black-forest-labs/FLUX.1-dev"
9
- #inferencia = "black-forest-labs/FLUX.1-dev"
10
  inferencia_backup = "black-forest-labs/FLUX.1-schnell"
11
  proveedor = "hf-inference" #falai
12
  proveedor_back = "fal-ai"
 
6
  llave, servidor = autenticacion.defineAmbiente()
7
  espacio = "black-forest-labs/FLUX.1-schnell"
8
  #espacio = "black-forest-labs/FLUX.1-dev"
9
+ inferencia = "black-forest-labs/FLUX.1-dev"
10
  inferencia_backup = "black-forest-labs/FLUX.1-schnell"
11
  proveedor = "hf-inference" #falai
12
  proveedor_back = "fal-ai"