Spaces:
Runtime error
Runtime error
import os, sys | |
from os.path import dirname as up | |
sys.path.append(os.path.abspath(os.path.join(up(__file__), os.pardir))) | |
from utils.helper import * | |
SAFETY_SETTINGS = [ | |
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH"}, | |
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_ONLY_HIGH"}, | |
{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_ONLY_HIGH"}, | |
{ | |
"category": "HARM_CATEGORY_DANGEROUS_CONTENT", | |
"threshold": "BLOCK_ONLY_HIGH", | |
}, | |
] | |
# Threshold options | |
THRESHOLD_OPTIONS = [ | |
"BLOCK_NONE", | |
"BLOCK_ONLY_HIGH", | |
"BLOCK_MEDIUM_AND_ABOVE", | |
"BLOCK_LOW_AND_ABOVE", | |
] | |
SAFETY_SETTINGS_VIDEO_LABELS = { | |
"HARM_CATEGORY_HARASSMENT": HarmCategory.HARM_CATEGORY_HARASSMENT, | |
"HARM_CATEGORY_HATE_SPEECH": HarmCategory.HARM_CATEGORY_HATE_SPEECH, | |
"HARM_CATEGORY_SEXUALLY_EXPLICIT": HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, | |
"HARM_CATEGORY_DANGEROUS_CONTENT": HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, | |
} | |
THRESHOLD_OPTIONS_VIDEO_LABELS = { | |
"BLOCK_NONE": HarmBlockThreshold.BLOCK_NONE, | |
"BLOCK_ONLY_HIGH": HarmBlockThreshold.BLOCK_ONLY_HIGH, | |
"BLOCK_MEDIUM_AND_ABOVE": HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, | |
"BLOCK_LOW_AND_ABOVE": HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, | |
} | |