Commit 7aa50ee1 authored by 赵威's avatar 赵威

try read

parent e527affb
...@@ -59,10 +59,14 @@ def main(): ...@@ -59,10 +59,14 @@ def main():
save_path = "/home/gmuser/data/models/1595501144" save_path = "/home/gmuser/data/models/1595501144"
predict_fn = tf.contrib.predictor.from_saved_model(save_path) predict_fn = tf.contrib.predictor.from_saved_model(save_path)
# device_id = "androidid_a25a1129c0b38f7b" device_id = "androidid_a25a1129c0b38f7b"
# offline_predict(device_id, device_dict, diary_dict, predict_fn) # offline_predict(device_id, device_dict, diary_dict, predict_fn)
user_portrait_scan_info(device_dict, diary_dict, predict_fn) res = user_portrait_tag3_get_candidate_unread_list(device_id, "diary")
print(len(res))
print(res[:10])
# user_portrait_scan_info(device_dict, diary_dict, predict_fn)
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -69,6 +69,20 @@ def remove_read_with_size(lol, content_type, read_list, size=500): ...@@ -69,6 +69,20 @@ def remove_read_with_size(lol, content_type, read_list, size=500):
return res return res
def get_n_unread_data_from_ids(data, size, read_lst):
"""
data: ['852170', '864084', '231589']
"""
res = []
for id_str in data:
id = int(id_str)
if len(res) >= size:
break
elif (id not in set(read_lst)) and (id not in res):
res.append(id)
return res
def _user_portrait_tag3_get_ctcvr_candidate_key(device_id, content_type): def _user_portrait_tag3_get_ctcvr_candidate_key(device_id, content_type):
""" """
device_id: device_id:
...@@ -128,8 +142,10 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type, size=5 ...@@ -128,8 +142,10 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type, size=5
read_list, _ = get_user_portrait_tag3_read_v2(device_id, content_type) read_list, _ = get_user_portrait_tag3_read_v2(device_id, content_type)
diary_dict = user_portrait_tag3_get_candidate_dict(device_id, "diary") diary_dict = user_portrait_tag3_get_candidate_dict(device_id, "diary")
if diary_dict: if diary_dict:
lol = remove_read_with_size(diary_dict.values(), "diary", read_list, size) # lol = remove_read_with_size(diary_dict.values(), "diary", read_list, size)
lol = diary_dict.values()
queue = merge_lists(*lol) queue = merge_lists(*lol)
get_n_unread_data_from_ids(queue, size, read_list)
return queue return queue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment