chore(SRC): :rocket: Comment output function code to find bug
Browse files
app.py
CHANGED
@@ -17,78 +17,87 @@ def clustering_responses(esfuerzo_dieta, objetivo, cumplimiento_entrenamiento,
|
|
17 |
|
18 |
def calcular_macros(esfuerzo_dieta, objetivo, cumplimiento_entrenamiento,
|
19 |
cumplimiento_dieta, compromiso, variacion_peso):
|
20 |
-
# Obtenemos los valores correspondientes a cada selecci贸n
|
21 |
-
valor_esfuerzo = next(list(opcion.values())[0]["value"]
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
valor_objetivo = next(list(opcion.values())[0]["value"]
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
valor_cumplimiento_entr = next(list(opcion.values())[0]["value"]
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
valor_cumplimiento_dieta = next(list(opcion.values())[0]["value"]
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
valor_compromiso = next(list(opcion.values())[0]["value"]
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
# Clustering
|
42 |
-
(cluster_esfuerzo_dieta, cluster_objetivo, cluster_entrenamiento, cluster_cumplimiento_dieta,
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
# Imprimimos los resultados
|
49 |
-
print(f"Consulta:")
|
50 |
-
print(f"\tEsfuerzo para cumplir dieta: {cluster_esfuerzo_dieta}")
|
51 |
-
print(f"\tObjetivo: {cluster_objetivo}")
|
52 |
-
print(f"\tEntrenamiento: {cluster_entrenamiento}")
|
53 |
-
print(f"\tCumplimiento dieta: {cluster_cumplimiento_dieta}")
|
54 |
-
print(f"\tCompromiso: {cluster_compromiso}")
|
55 |
-
print(f"\tVariaci贸n de peso: {variacion_peso}")
|
56 |
-
print(f"\t{diff_peso_min} <= Diferencia peso <= {diff_peso_max}")
|
57 |
|
58 |
-
# Crear query
|
59 |
-
query = make_query(cluster_esfuerzo_dieta, cluster_objetivo, cluster_entrenamiento, cluster_cumplimiento_dieta, cluster_compromiso, diff_peso_min, diff_peso_max)
|
60 |
|
61 |
-
# Print query
|
62 |
-
print(f"Query: {query}")
|
63 |
|
64 |
-
# Crear diccionario de matches
|
65 |
-
matches_dict = find_user_dates_matches(query)
|
66 |
|
67 |
-
# Print matches
|
68 |
-
print(f"Matches:\n{matches_dict}")
|
69 |
|
70 |
-
# Find macros that match dates of users
|
71 |
-
macros_differences_list = find_macros_that_match_dates_of_users(matches_dict)
|
72 |
|
73 |
-
# Print macros
|
74 |
-
print(f"Macros:\n{macros_differences_list}")
|
75 |
|
76 |
-
# Calculate macros min, max and mean
|
77 |
-
(train_day_protein_std, train_day_carbs_std, train_day_fat_std, intratrain_protein_std, intratrain_carbs_std,
|
78 |
-
|
|
|
|
|
|
|
79 |
|
80 |
-
#
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
rest_day_fat_str = f"min: {rest_day_fat_std[0]}, max: {rest_day_fat_std[1]}, mean: {rest_day_fat_std[2]:.2f}, mode: {rest_day_fat_std[3]}"
|
92 |
|
93 |
return train_day_protein_str, train_day_carbs_str, train_day_fat_str, intratrain_protein_str, intratrain_carbs_str, rest_day_protein_str, rest_day_carbs_str, rest_day_fat_str
|
94 |
|
@@ -392,5 +401,5 @@ with gr.Blocks() as demo:
|
|
392 |
proteina_descanso, carbs_descanso, grasas_descanso]
|
393 |
)
|
394 |
|
395 |
-
demo.launch()
|
396 |
|
|
|
17 |
|
18 |
def calcular_macros(esfuerzo_dieta, objetivo, cumplimiento_entrenamiento,
|
19 |
cumplimiento_dieta, compromiso, variacion_peso):
|
20 |
+
# # Obtenemos los valores correspondientes a cada selecci贸n
|
21 |
+
# valor_esfuerzo = next(list(opcion.values())[0]["value"]
|
22 |
+
# for opcion in opciones_esfuerzo
|
23 |
+
# if list(opcion.values())[0]["text"] == esfuerzo_dieta)
|
24 |
|
25 |
+
# valor_objetivo = next(list(opcion.values())[0]["value"]
|
26 |
+
# for opcion in opciones_objetivo
|
27 |
+
# if list(opcion.values())[0]["text"] == objetivo)
|
28 |
|
29 |
+
# valor_cumplimiento_entr = next(list(opcion.values())[0]["value"]
|
30 |
+
# for opcion in opciones_cumplimiento_entrenamiento
|
31 |
+
# if list(opcion.values())[0]["text"] == cumplimiento_entrenamiento)
|
32 |
|
33 |
+
# valor_cumplimiento_dieta = next(list(opcion.values())[0]["value"]
|
34 |
+
# for opcion in opciones_cumplimiento_dieta
|
35 |
+
# if list(opcion.values())[0]["text"] == cumplimiento_dieta)
|
36 |
|
37 |
+
# valor_compromiso = next(list(opcion.values())[0]["value"]
|
38 |
+
# for opcion in opciones_compromiso
|
39 |
+
# if list(opcion.values())[0]["text"] == compromiso)
|
40 |
|
41 |
+
# # Clustering
|
42 |
+
# (cluster_esfuerzo_dieta, cluster_objetivo, cluster_entrenamiento, cluster_cumplimiento_dieta,
|
43 |
+
# cluster_compromiso, diff_peso_min, diff_peso_max) = clustering_responses(valor_esfuerzo, valor_objetivo,
|
44 |
+
# valor_cumplimiento_entr,
|
45 |
+
# valor_cumplimiento_dieta, valor_compromiso,
|
46 |
+
# variacion_peso)
|
47 |
|
48 |
+
# # Imprimimos los resultados
|
49 |
+
# print(f"Consulta:")
|
50 |
+
# print(f"\tEsfuerzo para cumplir dieta: {cluster_esfuerzo_dieta}")
|
51 |
+
# print(f"\tObjetivo: {cluster_objetivo}")
|
52 |
+
# print(f"\tEntrenamiento: {cluster_entrenamiento}")
|
53 |
+
# print(f"\tCumplimiento dieta: {cluster_cumplimiento_dieta}")
|
54 |
+
# print(f"\tCompromiso: {cluster_compromiso}")
|
55 |
+
# print(f"\tVariaci贸n de peso: {variacion_peso}")
|
56 |
+
# print(f"\t{diff_peso_min} <= Diferencia peso <= {diff_peso_max}")
|
57 |
|
58 |
+
# # Crear query
|
59 |
+
# query = make_query(cluster_esfuerzo_dieta, cluster_objetivo, cluster_entrenamiento, cluster_cumplimiento_dieta, cluster_compromiso, diff_peso_min, diff_peso_max)
|
60 |
|
61 |
+
# # Print query
|
62 |
+
# print(f"Query: {query}")
|
63 |
|
64 |
+
# # Crear diccionario de matches
|
65 |
+
# matches_dict = find_user_dates_matches(query)
|
66 |
|
67 |
+
# # Print matches
|
68 |
+
# print(f"Matches:\n{matches_dict}")
|
69 |
|
70 |
+
# # Find macros that match dates of users
|
71 |
+
# macros_differences_list = find_macros_that_match_dates_of_users(matches_dict)
|
72 |
|
73 |
+
# # Print macros
|
74 |
+
# print(f"Macros:\n{macros_differences_list}")
|
75 |
|
76 |
+
# # Calculate macros min, max and mean
|
77 |
+
# (train_day_protein_std, train_day_carbs_std, train_day_fat_std, intratrain_protein_std, intratrain_carbs_std,
|
78 |
+
# rest_day_protein_std, rest_day_carbs_std, rest_day_fat_std) = get_min_max_mean_mode_macros_differences(macros_differences_list)
|
79 |
+
|
80 |
+
# # Print macros min, max and mean
|
81 |
+
# print(f"Macros min, max and mean:\n{train_day_protein_std}, {train_day_carbs_std}, {train_day_fat_std}, {intratrain_protein_std}, {intratrain_carbs_std}, {rest_day_protein_std}, {rest_day_carbs_std}, {rest_day_fat_std}")
|
82 |
|
83 |
+
# # Create strings for the outputs
|
84 |
+
# train_day_protein_str = f"min: {train_day_protein_std[0]}, max: {train_day_protein_std[1]}, mean: {train_day_protein_std[2]:.2f}, mode: {train_day_protein_std[3]}"
|
85 |
+
# train_day_carbs_str = f"min: {train_day_carbs_std[0]}, max: {train_day_carbs_std[1]}, mean: {train_day_carbs_std[2]:.2f}, mode: {train_day_carbs_std[3]}"
|
86 |
+
# train_day_fat_str = f"min: {train_day_fat_std[0]}, max: {train_day_fat_std[1]}, mean: {train_day_fat_std[2]:.2f}, mode: {train_day_fat_std[3]}"
|
87 |
+
# intratrain_protein_str = f"min: {intratrain_protein_std[0]}, max: {intratrain_protein_std[1]}, mean: {intratrain_protein_std[2]:.2f}, mode: {intratrain_protein_std[3]}"
|
88 |
+
# intratrain_carbs_str = f"min: {intratrain_carbs_std[0]}, max: {intratrain_carbs_std[1]}, mean: {intratrain_carbs_std[2]:.2f}, mode: {intratrain_carbs_std[3]}"
|
89 |
+
# rest_day_protein_str = f"min: {rest_day_protein_std[0]}, max: {rest_day_protein_std[1]}, mean: {rest_day_protein_std[2]:.2f}, mode: {rest_day_protein_std[3]}"
|
90 |
+
# rest_day_carbs_str = f"min: {rest_day_carbs_std[0]}, max: {rest_day_carbs_std[1]}, mean: {rest_day_carbs_std[2]:.2f}, mode: {rest_day_carbs_std[3]}"
|
91 |
+
# rest_day_fat_str = f"min: {rest_day_fat_std[0]}, max: {rest_day_fat_std[1]}, mean: {rest_day_fat_std[2]:.2f}, mode: {rest_day_fat_std[3]}"
|
92 |
|
93 |
+
train_day_protein_str = "0"
|
94 |
+
train_day_carbs_str = "0"
|
95 |
+
train_day_fat_str = "0"
|
96 |
+
intratrain_protein_str = "0"
|
97 |
+
intratrain_carbs_str = "0"
|
98 |
+
rest_day_protein_str = "0"
|
99 |
+
rest_day_carbs_str = "0"
|
100 |
+
rest_day_fat_str = "0"
|
|
|
101 |
|
102 |
return train_day_protein_str, train_day_carbs_str, train_day_fat_str, intratrain_protein_str, intratrain_carbs_str, rest_day_protein_str, rest_day_carbs_str, rest_day_fat_str
|
103 |
|
|
|
401 |
proteina_descanso, carbs_descanso, grasas_descanso]
|
402 |
)
|
403 |
|
404 |
+
demo.launch(share=True)
|
405 |
|