jccolon commited on
Commit
2854708
·
verified ·
1 Parent(s): ab8b6dc

Update app/ui/main_app.py

Browse files
Files changed (1) hide show
  1. app/ui/main_app.py +38 -20
app/ui/main_app.py CHANGED
@@ -161,35 +161,53 @@ else:
161
  # ---------------------------------------
162
  st.sidebar.header(T["search_config"])
163
 
164
- # --- Modo de análisis (FUERA del form) ---
165
- mode = st.sidebar.radio(
166
- T["analysis_mode"],
167
- options=["rapido", "preciso"],
168
- format_func=lambda x: T["fast"] if x == "rapido" else T["precise"],
169
- key="analysis_mode"
170
- )
 
 
 
 
 
 
 
 
 
 
 
171
 
172
- # --- Precarga del modelo preciso (FUERA del form) ---
173
- if mode == "preciso":
174
- if st.sidebar.button(T["preload_bert"], key="preload_bert_btn"):
175
- with st.spinner(T["loading_bert"]):
176
- load_sentiment_components()
 
177
 
178
- # --- Formulario de búsqueda (SOLO parámetros) ---
179
- with st.sidebar.form("search_form"):
180
- topic = st.text_input(T["search"], value=T["default_topic"])
181
- days_back = st.slider(T["days_back"], 7, 365, 30)
182
- max_posts = st.number_input(T["max_posts"], 1, 100000, 1000)
183
- operator = st.radio(T["operator"], ["AND", "OR"], horizontal=True)
184
 
185
  require_confirm = max_posts > MAX_POSTS_WARNING
186
  if require_confirm:
187
  st.warning(T["large_request"])
188
- confirm_heavy = st.checkbox(T["confirm"])
 
 
 
189
  else:
190
  confirm_heavy = True
191
 
192
- submitted = st.form_submit_button(T["search"])
 
 
 
193
 
194
  # ---------------------------------------
195
  # Buscar + Analizar
 
161
  # ---------------------------------------
162
  st.sidebar.header(T["search_config"])
163
 
164
+ with st.sidebar.form("search_form", clear_on_submit=False):
165
+ topic = st.text_input(
166
+ T["search"],
167
+ value=T["default_topic"],
168
+ key="param_topic"
169
+ )
170
+
171
+ days_back = st.slider(
172
+ T["days_back"],
173
+ 7, 365, 30,
174
+ key="param_days"
175
+ )
176
+
177
+ max_posts = st.number_input(
178
+ T["max_posts"],
179
+ 1, 100000, 1000,
180
+ key="param_max"
181
+ )
182
 
183
+ operator = st.radio(
184
+ T["operator"],
185
+ ["AND", "OR"],
186
+ horizontal=True,
187
+ key="param_op"
188
+ )
189
 
190
+ mode = st.radio(
191
+ T["analysis_mode"],
192
+ options=["rapido", "preciso"],
193
+ format_func=lambda x: T["fast"] if x == "rapido" else T["precise"],
194
+ key="param_mode",
195
+ )
196
 
197
  require_confirm = max_posts > MAX_POSTS_WARNING
198
  if require_confirm:
199
  st.warning(T["large_request"])
200
+ confirm_heavy = st.checkbox(
201
+ T["confirm"],
202
+ key="param_confirm"
203
+ )
204
  else:
205
  confirm_heavy = True
206
 
207
+ submitted = st.form_submit_button(
208
+ T["search"],
209
+ use_container_width=True
210
+ )
211
 
212
  # ---------------------------------------
213
  # Buscar + Analizar