Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1072,7 +1072,7 @@ with col_img1:
|
|
| 1072 |
if os.path.exists("imagen.png"): st.image("imagen.png", width=150)
|
| 1073 |
with col_text:
|
| 1074 |
st.title("El Detective de Alimentos")
|
| 1075 |
-
st.markdown("#####
|
| 1076 |
with col_img2:
|
| 1077 |
if os.path.exists("buho.png"): st.image("buho.png", width=120)
|
| 1078 |
st.markdown("---")
|
|
@@ -1094,16 +1094,39 @@ def set_query_and_trigger_analysis(example_text):
|
|
| 1094 |
st.session_state.query = example_text
|
| 1095 |
st.session_state.start_analysis = True
|
| 1096 |
|
| 1097 |
-
st.write("**驴No sabes por d贸nde empezar?
|
| 1098 |
example_cols = st.columns(3)
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
if example_cols[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1103 |
|
| 1104 |
with st.form(key="search_form"):
|
| 1105 |
-
st.text_area(
|
| 1106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1107 |
st.session_state.start_analysis = True
|
| 1108 |
|
| 1109 |
if st.session_state.start_analysis:
|
|
|
|
| 1072 |
if os.path.exists("imagen.png"): st.image("imagen.png", width=150)
|
| 1073 |
with col_text:
|
| 1074 |
st.title("El Detective de Alimentos")
|
| 1075 |
+
st.markdown("##### Para un an谩lisis preciso, describe primero tus S脥NTOMAS y luego los ALIMENTOS que sospechas.")
|
| 1076 |
with col_img2:
|
| 1077 |
if os.path.exists("buho.png"): st.image("buho.png", width=120)
|
| 1078 |
st.markdown("---")
|
|
|
|
| 1094 |
st.session_state.query = example_text
|
| 1095 |
st.session_state.start_analysis = True
|
| 1096 |
|
| 1097 |
+
st.write("**驴No sabes por d贸nde empezar? Haz clic en un ejemplo para analizar un caso estructurado:** (Los procesos toman 3 o 4 segundos)")
|
| 1098 |
example_cols = st.columns(3)
|
| 1099 |
+
|
| 1100 |
+
# --- EJEMPLO 1: GOTA ---
|
| 1101 |
+
example1_text = "S脥NTOMAS: dolor intenso, hinchaz贸n y se pone rojo el primer dedo del pie.\nALIMENTOS: carne roja, cerveza."
|
| 1102 |
+
if example_cols[0].button("Caso: Dolor en el pie por carne"):
|
| 1103 |
+
set_query_and_trigger_analysis(example1_text)
|
| 1104 |
+
|
| 1105 |
+
# --- EJEMPLO 2: INTOLERANCIA A LA LACTOSA ---
|
| 1106 |
+
example2_text = "S脥NTOMAS: muchos gases, hinchaz贸n abdominal.\nALIMENTOS: leche, queso."
|
| 1107 |
+
if example_cols[1].button("Caso: Hinchaz贸n por l谩cteos"):
|
| 1108 |
+
set_query_and_trigger_analysis(example2_text)
|
| 1109 |
+
|
| 1110 |
+
# --- EJEMPLO 3: MIGRA脩A POR VINO ---
|
| 1111 |
+
example3_text = "S脥NTOMAS: dolor de cabeza, migra帽a.\nALIMENTOS: vino tinto."
|
| 1112 |
+
if example_cols[2].button("Caso: Dolor de cabeza por vino"):
|
| 1113 |
+
set_query_and_trigger_analysis(example3_text)
|
| 1114 |
+
|
| 1115 |
+
# Muestra el texto del ejemplo debajo de los botones para que el usuario aprenda el formato
|
| 1116 |
+
with st.expander("Ver formato recomendado para los ejemplos"):
|
| 1117 |
+
st.code(f"Ejemplo 1 (Gota):\n{example1_text}", language='text')
|
| 1118 |
+
st.code(f"Ejemplo 2 (Lactosa):\n{example2_text}", language='text')
|
| 1119 |
+
st.code(f"Ejemplo 3 (Vino):\n{example3_text}", language='text')
|
| 1120 |
|
| 1121 |
with st.form(key="search_form"):
|
| 1122 |
+
st.text_area(
|
| 1123 |
+
"Describe tu caso aqu铆, separando S脥NTOMAS y ALIMENTOS:",
|
| 1124 |
+
height=200,
|
| 1125 |
+
key="query",
|
| 1126 |
+
placeholder=placeholder_text
|
| 1127 |
+
)
|
| 1128 |
+
submitted = st.form_submit_button("Analizar mi caso", type="primary")
|
| 1129 |
+
if submitted:
|
| 1130 |
st.session_state.start_analysis = True
|
| 1131 |
|
| 1132 |
if st.session_state.start_analysis:
|