bradley6597 commited on
Commit
1267ef7
1 Parent(s): 93842c9

Added search term logging

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -134,8 +134,9 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
134
  '</center>')
135
 
136
 
137
- def log_clicks(x):
138
- print(x)
 
139
 
140
 
141
  with gr.Blocks(css="style.css") as app:
@@ -159,6 +160,8 @@ with gr.Blocks(css="style.css") as app:
159
  output_df = gr.HTML()
160
  search_button.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
161
  search_prompt.submit(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
 
 
162
  app.load(_js = logging_js)
163
 
164
  app.auth = (same_auth)
 
134
  '</center>')
135
 
136
 
137
+ def search_logging(x: str, request: gr.Request):
138
+ session_id = getattr(request.cookies, 'access-token')
139
+ logger.flag(['', x, session_id])
140
 
141
 
142
  with gr.Blocks(css="style.css") as app:
 
160
  output_df = gr.HTML()
161
  search_button.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
162
  search_prompt.submit(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
163
+ search_button.click(search_logging, inputs=[search_prompt], outputs=None)
164
+ search_prompt.submit(search_logging, inputs=[search_prompt], outputs=None)
165
  app.load(_js = logging_js)
166
 
167
  app.auth = (same_auth)