bradley6597 commited on
Commit
3beb244
1 Parent(s): 9c77e10

Added datetime flag

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -9,12 +9,13 @@ from fastapi import FastAPI, Request
9
  import uvicorn
10
  from starlette.middleware.sessions import SessionMiddleware
11
  import fastapi
 
12
 
13
  login(token = os.environ['HUB_TOKEN'])
14
 
15
 
16
  logger = gr.HuggingFaceDatasetSaver(os.environ['HUB_TOKEN'], dataset_name='illustration_gdrive_logging_main', organization=None, private=True)
17
- logger.setup([gr.Text(label="clicked_url"), gr.Text(label="seach_term"), gr.Text(label = 'sessionhash')], './flagged_data_points')
18
 
19
  logging_js = '''
20
  function magicFunc(x){
@@ -136,7 +137,7 @@ def search_index(search_text, sd, ks, sort_by, max_results, user_num, search_tit
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:
@@ -187,7 +188,7 @@ async def track(url: str, q: str, request: Request):
187
  if q is None:
188
  q = ''
189
 
190
- logger.flag([url, q, request.cookies['access-token']])
191
  return {"message": "ok"}
192
 
193
 
 
9
  import uvicorn
10
  from starlette.middleware.sessions import SessionMiddleware
11
  import fastapi
12
+ from datetime import datetime
13
 
14
  login(token = os.environ['HUB_TOKEN'])
15
 
16
 
17
  logger = gr.HuggingFaceDatasetSaver(os.environ['HUB_TOKEN'], dataset_name='illustration_gdrive_logging_main', organization=None, private=True)
18
+ logger.setup([gr.Text(label="clicked_url"), gr.Text(label="seach_term"), gr.Text(label = 'sessionhash'), gr.Text(label = 'datetime')], './flagged_data_points')
19
 
20
  logging_js = '''
21
  function magicFunc(x){
 
137
 
138
  def search_logging(x: str, request: gr.Request):
139
  session_id = getattr(request.cookies, 'access-token')
140
+ logger.flag(['', x, session_id, str(datetime.now())])
141
 
142
 
143
  with gr.Blocks(css="style.css") as app:
 
188
  if q is None:
189
  q = ''
190
 
191
+ logger.flag([url, q, request.cookies['access-token'], str(datetime.now())])
192
  return {"message": "ok"}
193
 
194