GMARTINEZMILLA commited on
Commit
81f653c
·
verified ·
1 Parent(s): 2458498

Update app.py

Browse files

We test lottie file loading.

Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -12,6 +12,7 @@ from sklearn.metrics import mean_absolute_error, mean_squared_error
12
  from joblib import dump, load
13
  from utils import recomienda_tf
14
  from utils import retroalimentacion
 
15
  import requests
16
 
17
  # Page configuration
@@ -117,6 +118,16 @@ def get_supplier_name(code):
117
  name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
118
  return name[0] if len(name) > 0 else code
119
 
 
 
 
 
 
 
 
 
 
 
120
  def image_exists(url):
121
  """Verifica si la imagen existe en la URL proporcionada"""
122
  response = requests.head(url)
@@ -929,6 +940,7 @@ elif page == "💡 Recomendación de Artículos":
929
  # Añadir el artículo seleccionado a la cesta
930
  if code not in st.session_state['new_basket']:
931
  st.session_state['new_basket'].append(code)
 
932
  st.rerun()
933
 
934
  # Añadir un botón estilizado "Calcular" con icono
@@ -1024,5 +1036,4 @@ elif page == "💡 Recomendación de Artículos":
1024
  else:
1025
  st.warning("⚠️ No hay artículos en la cesta para añadir.")
1026
  elif st.session_state['recommendations_df'] is not None:
1027
- st.warning("⚠️ No se encontraron recomendaciones para la cesta proporcionada.")
1028
-
 
12
  from joblib import dump, load
13
  from utils import recomienda_tf
14
  from utils import retroalimentacion
15
+ from streamlit_lottie import st_lottie
16
  import requests
17
 
18
  # Page configuration
 
118
  name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
119
  return name[0] if len(name) > 0 else code
120
 
121
+ def load_lottie_url(url):
122
+ response = requests.get(url)
123
+ if response.status_code == 200:
124
+ return response.json()
125
+ else:
126
+ return None
127
+
128
+ # Load the animation
129
+ lottie_animation = load_lottie_file("LoadingAnimation/Animation.json")
130
+
131
  def image_exists(url):
132
  """Verifica si la imagen existe en la URL proporcionada"""
133
  response = requests.head(url)
 
940
  # Añadir el artículo seleccionado a la cesta
941
  if code not in st.session_state['new_basket']:
942
  st.session_state['new_basket'].append(code)
943
+ st_lottie(lottie_animation, height=200, width=200)
944
  st.rerun()
945
 
946
  # Añadir un botón estilizado "Calcular" con icono
 
1036
  else:
1037
  st.warning("⚠️ No hay artículos en la cesta para añadir.")
1038
  elif st.session_state['recommendations_df'] is not None:
1039
+ st.warning("⚠️ No se encontraron recomendaciones para la cesta proporcionada.")