daviddao commited on
Commit
2605ea7
·
1 Parent(s): 8763ac7

update CRON jobs

Browse files
Files changed (3) hide show
  1. bot.py +2 -2
  2. redis2sheets_img.py +2 -2
  3. redis2sheets_sound.py +2 -2
bot.py CHANGED
@@ -156,7 +156,7 @@ async def identify_image(ctx, id:int, label:str, confidence: str):
156
  conf_score = get_conf_score(confidence)
157
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'confidence', conf_score)
158
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'role', role)
159
- r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'authorid', author_id)
160
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'timestamp', timestamp)
161
 
162
  r.hset(f'image:{id}'.encode('utf-8'), b'label', label.encode('utf-8'))
@@ -227,7 +227,7 @@ async def identify_sound(ctx, id:int, label:str, timestamp:str, confidence: str)
227
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'label_at', timestamp.encode('utf-8'))
228
  conf_score = get_conf_score(confidence)
229
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'confidence', conf_score)
230
- r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'authorid', author_id)
231
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'timestamp', timestamp)
232
 
233
  r.hset(f'sound:{id}'.encode('utf-8'), b'label', label.encode('utf-8'))
 
156
  conf_score = get_conf_score(confidence)
157
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'confidence', conf_score)
158
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'role', role)
159
+ r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'author_id', author_id)
160
  r.hset(f'label:image:{id}:{label_cnt}'.encode('utf-8'), b'timestamp', timestamp)
161
 
162
  r.hset(f'image:{id}'.encode('utf-8'), b'label', label.encode('utf-8'))
 
227
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'label_at', timestamp.encode('utf-8'))
228
  conf_score = get_conf_score(confidence)
229
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'confidence', conf_score)
230
+ r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'author_id', author_id)
231
  r.hset(f'label:sound:{id}:{label_cnt}'.encode('utf-8'), b'timestamp', timestamp)
232
 
233
  r.hset(f'sound:{id}'.encode('utf-8'), b'label', label.encode('utf-8'))
redis2sheets_img.py CHANGED
@@ -9,7 +9,7 @@ gc = gspread.service_account()
9
  # Open a sheet from a spreadsheet in one go
10
  wks = gc.open("Labels").sheet1
11
 
12
- rows = [['image id', 'label id', 'author', 'role', 'label', 'confidence (0 = low, 1 = medium, 2 = high)', 'image url', 'dashboard url', 'image preview']]
13
 
14
  redis_keys = r.keys('label:image:*')
15
  for i_key in redis_keys:
@@ -20,7 +20,7 @@ for i_key in redis_keys:
20
  raw_image_data = {k.decode('utf-8'): v.decode('utf-8') for k, v in raw_image_data_bytes.items()}
21
  path = f'https://gainforest-transparency-dashboard.s3.amazonaws.com/{raw_image_data["awsCID"]}'
22
  dashboard_url = f'https://gainforest.app/observations/{raw_image_data["uuid"]}'
23
- row = [image_id, i_key.decode().split(':')[-1], image_data['author'], image_data['role'], image_data['label'], image_data['confidence'], path, dashboard_url,'=IMAGE("{}", 2)'.format(path)]
24
  rows.append(row)
25
 
26
  # Update a range of cells using the top left corner address
 
9
  # Open a sheet from a spreadsheet in one go
10
  wks = gc.open("Labels").sheet1
11
 
12
+ rows = [['image id', 'label id', 'author', 'author_id', 'role', 'submitted_on', 'label', 'confidence (0 = low, 1 = medium, 2 = high)', 'image url', 'dashboard url', 'image preview']]
13
 
14
  redis_keys = r.keys('label:image:*')
15
  for i_key in redis_keys:
 
20
  raw_image_data = {k.decode('utf-8'): v.decode('utf-8') for k, v in raw_image_data_bytes.items()}
21
  path = f'https://gainforest-transparency-dashboard.s3.amazonaws.com/{raw_image_data["awsCID"]}'
22
  dashboard_url = f'https://gainforest.app/observations/{raw_image_data["uuid"]}'
23
+ row = [image_id, i_key.decode().split(':')[-1], image_data['author'], image_data['author_id'], image_data['role'], image_data['timestamp'], image_data['label'], image_data['confidence'], path, dashboard_url,'=IMAGE("{}", 2)'.format(path)]
24
  rows.append(row)
25
 
26
  # Update a range of cells using the top left corner address
redis2sheets_sound.py CHANGED
@@ -9,7 +9,7 @@ gc = gspread.service_account()
9
  # Open a sheet from a spreadsheet in one for sound
10
  wks = gc.open("Labels").get_worksheet(1)
11
 
12
- rows = [['sound id', 'label id', 'author', 'role', 'timestamp', 'label', 'confidence (0 = low, 1 = medium, 2 = high)', 'sound url', 'dashboard url']]
13
 
14
  redis_keys = r.keys('label:sound:*')
15
  for i_key in redis_keys:
@@ -20,7 +20,7 @@ for i_key in redis_keys:
20
  raw_sound_data = {k.decode('utf-8'): v.decode('utf-8') for k, v in raw_sound_data_bytes.items()}
21
  path = f'https://gainforest-transparency-dashboard.s3.amazonaws.com/{raw_sound_data["awsCID"]}'
22
  dashboard_url = f'https://gainforest.app/observations/{raw_sound_data["uuid"]}'
23
- row = [sound_id, i_key.decode().split(':')[-1], sound_data['author'], sound_data['role'], sound_data['label_at'], sound_data['label'], sound_data['confidence'], path, dashboard_url]
24
  rows.append(row)
25
 
26
  # Update a range of cells using the top left corner address
 
9
  # Open a sheet from a spreadsheet in one for sound
10
  wks = gc.open("Labels").get_worksheet(1)
11
 
12
+ rows = [['sound id', 'label id', 'author', 'author_id', 'role', 'submitted on', 'label at', 'label', 'confidence (0 = low, 1 = medium, 2 = high)', 'sound url', 'dashboard url']]
13
 
14
  redis_keys = r.keys('label:sound:*')
15
  for i_key in redis_keys:
 
20
  raw_sound_data = {k.decode('utf-8'): v.decode('utf-8') for k, v in raw_sound_data_bytes.items()}
21
  path = f'https://gainforest-transparency-dashboard.s3.amazonaws.com/{raw_sound_data["awsCID"]}'
22
  dashboard_url = f'https://gainforest.app/observations/{raw_sound_data["uuid"]}'
23
+ row = [sound_id, i_key.decode().split(':')[-1], sound_data['author'], sound_data['author_id'], sound_data['role'], sound_data['timestamp'], sound_data['label_at'], sound_data['label'], sound_data['confidence'], path, dashboard_url]
24
  rows.append(row)
25
 
26
  # Update a range of cells using the top left corner address