CarlosMalaga
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -361,31 +361,32 @@ def run_client():
|
|
361 |
if candidates_text:
|
362 |
st.session_state.candidates = candidates_text[:10]
|
363 |
|
364 |
-
dict_of_ents_candidates, options_candidates = get_retriever_annotations_candidates(text, st.session_state.candidates)
|
365 |
-
|
366 |
-
st.markdown("<h2 style='color: black;'>Possible Candidates:</h2>", unsafe_allow_html=True)
|
367 |
-
|
368 |
-
# Display the candidates with checkboxes
|
369 |
-
for candidate in dict_of_ents_candidates["ents"]:
|
370 |
-
if st.checkbox(candidate, key=candidate):
|
371 |
-
if candidate not in st.session_state.selected_candidates:
|
372 |
-
st.session_state.selected_candidates.append(candidate)
|
373 |
-
else:
|
374 |
-
if candidate in st.session_state.selected_candidates:
|
375 |
-
st.session_state.selected_candidates.remove(candidate)
|
376 |
-
|
377 |
-
# Button to save the selected candidates to a file
|
378 |
-
if st.button("Save Selected Candidates"):
|
379 |
-
write_candidates_to_file(text, dict_of_ents_candidates["ents"], st.session_state.selected_candidates)
|
380 |
-
st.success("Selected candidates have been saved to file.")
|
381 |
else:
|
382 |
st.session_state.candidates = []
|
383 |
st.session_state.selected_candidates = []
|
384 |
st.markdown("<h2 style='color: black;'>No Candidates Found</h2>", unsafe_allow_html=True)
|
385 |
-
|
386 |
else:
|
387 |
st.error("Please enter some text.")
|
388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
if __name__ == "__main__":
|
391 |
run_client()
|
|
|
361 |
if candidates_text:
|
362 |
st.session_state.candidates = candidates_text[:10]
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
else:
|
365 |
st.session_state.candidates = []
|
366 |
st.session_state.selected_candidates = []
|
367 |
st.markdown("<h2 style='color: black;'>No Candidates Found</h2>", unsafe_allow_html=True)
|
368 |
+
|
369 |
else:
|
370 |
st.error("Please enter some text.")
|
371 |
|
372 |
+
if st.session_state.candidates:
|
373 |
+
dict_of_ents_candidates, options_candidates = get_retriever_annotations_candidates(text, st.session_state.candidates)
|
374 |
+
|
375 |
+
st.markdown("<h2 style='color: black;'>Possible Candidates:</h2>", unsafe_allow_html=True)
|
376 |
+
|
377 |
+
# Display the candidates with checkboxes
|
378 |
+
for candidate in dict_of_ents_candidates["ents"]:
|
379 |
+
if st.checkbox(candidate, key=candidate):
|
380 |
+
if candidate not in st.session_state.selected_candidates:
|
381 |
+
st.session_state.selected_candidates.append(candidate)
|
382 |
+
else:
|
383 |
+
if candidate in st.session_state.selected_candidates:
|
384 |
+
st.session_state.selected_candidates.remove(candidate)
|
385 |
+
|
386 |
+
# Button to save the selected candidates to a file
|
387 |
+
if st.button("Save Selected Candidates"):
|
388 |
+
write_candidates_to_file(text, dict_of_ents_candidates["ents"], st.session_state.selected_candidates)
|
389 |
+
st.success("Selected candidates have been saved to file.")
|
390 |
|
391 |
if __name__ == "__main__":
|
392 |
run_client()
|