CarlosMalaga commited on
Commit
3a2d753
1 Parent(s): 16f0e9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -14,6 +14,11 @@ import streamlit as st
14
  from spacy import displacy
15
  from streamlit_extras.badges import badge
16
  from streamlit_extras.stylable_container import stylable_container
 
 
 
 
 
17
 
18
  # RELIK = os.getenv("RELIK", "localhost:8000/api/entities")
19
 
@@ -244,17 +249,8 @@ def set_intro(css):
244
 
245
 
246
  def write_candidates_to_file(text, candidates, selected_candidates):
247
- try:
248
- # Ensure the directory exists
249
- os.makedirs("logs", exist_ok=True)
250
- # Write the selected candidates to a file
251
- with open("logs/selected_candidates.tsv", "a") as file:
252
- file.write(f"{text}\t{str(candidates)}\t{str(selected_candidates)}\n")
253
- return True
254
- except Exception as e:
255
- st.error(f"An error occurred while writing the file: {e}")
256
- return False
257
-
258
 
259
  def run_client():
260
  with open(Path(__file__).parent / "style.css") as f:
 
14
  from spacy import displacy
15
  from streamlit_extras.badges import badge
16
  from streamlit_extras.stylable_container import stylable_container
17
+ import logging
18
+
19
+ # Configure logging
20
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')
21
+ logger = logging.getLogger()
22
 
23
  # RELIK = os.getenv("RELIK", "localhost:8000/api/entities")
24
 
 
249
 
250
 
251
  def write_candidates_to_file(text, candidates, selected_candidates):
252
+ logger.info(f"Text: {text}\tCandidates: {str(candidates)}\tSelected Candidates: {str(selected_candidates)}\n")
253
+
 
 
 
 
 
 
 
 
 
254
 
255
  def run_client():
256
  with open(Path(__file__).parent / "style.css") as f: