remove some debug prints
This commit is contained in:
parent
33b4b8404b
commit
f88e2362c5
|
@ -14,8 +14,6 @@ def check_moderation_endpoint(prompt: str):
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
response = response.json()
|
response = response.json()
|
||||||
|
|
||||||
print(response)
|
|
||||||
|
|
||||||
offending_categories = []
|
offending_categories = []
|
||||||
for k, v in response['results'][0]['categories'].items():
|
for k, v in response['results'][0]['categories'].items():
|
||||||
if v:
|
if v:
|
||||||
|
|
|
@ -39,7 +39,7 @@ def get_results(tag, num_tasks):
|
||||||
flagged_categories.add(item)
|
flagged_categories.add(item)
|
||||||
num_results += 1
|
num_results += 1
|
||||||
if time.time() - start_time > opts.openai_moderation_timeout:
|
if time.time() - start_time > opts.openai_moderation_timeout:
|
||||||
print('Timed out waiting for result from moderator.')
|
print('----> Timed out waiting for result from moderator.')
|
||||||
break
|
break
|
||||||
return list(flagged_categories)
|
return list(flagged_categories)
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ def moderation_worker():
|
||||||
result = redis_moderation.blpop(['queue:msgs_to_check'])
|
result = redis_moderation.blpop(['queue:msgs_to_check'])
|
||||||
try:
|
try:
|
||||||
msg, tag = json.loads(result[1])
|
msg, tag = json.loads(result[1])
|
||||||
print(tag)
|
|
||||||
_, categories = check_moderation_endpoint(msg)
|
_, categories = check_moderation_endpoint(msg)
|
||||||
redis_moderation.rpush('queue:flagged_categories', json.dumps((tag, categories)))
|
redis_moderation.rpush('queue:flagged_categories', json.dumps((tag, categories)))
|
||||||
except:
|
except:
|
||||||
|
|
Reference in New Issue