alymbeks commited on
Commit
a4b8145
·
1 Parent(s): fe45a00

log to console instead of file

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -6,11 +6,7 @@ import gradio as gr
6
  import zipfile
7
  import logging
8
 
9
- logger = logging.getLogger("query_search")
10
- logger.setLevel(logging.INFO)
11
- handler = logging.FileHandler('queries.log', 'a', 'utf-8')
12
- handler.setFormatter(logging.Formatter('%(asctime)s query: %(message)s'))
13
- logger.addHandler(handler)
14
 
15
  # Load CLIP model
16
  text_model = SentenceTransformer("clip-ViT-B-32-multilingual-v1")
@@ -56,7 +52,8 @@ def search_text(query, top_k=1):
56
  Returns:
57
  [list]: [list of images that are related to the query.]
58
  """
59
- logger.info(f"{query}, {top_k}")
 
60
  # First, we encode the query.
61
  query_emb = text_model.encode([query])
62
 
 
6
  import zipfile
7
  import logging
8
 
9
+ logger = logging.getLogger(__name__)
 
 
 
 
10
 
11
  # Load CLIP model
12
  text_model = SentenceTransformer("clip-ViT-B-32-multilingual-v1")
 
52
  Returns:
53
  [list]: [list of images that are related to the query.]
54
  """
55
+ log_query = query.encode("utf-8").decode("utf-8")
56
+ logger.warning(f"{log_query}, {top_k}")
57
  # First, we encode the query.
58
  query_emb = text_model.encode([query])
59