File size: 1,508 Bytes
f1316e7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import google.generativeai as genai
from vertexai.preview.generative_models import (
HarmCategory,
HarmBlockThreshold )
from google.cloud.aiplatform_v1beta1.types.content import SafetySetting
GOOGLE_API_KEY="AIzaSyBiWhI-TOWmlahl5puqDAsAvFu0N1_R1HQ"
genai.configure(api_key=GOOGLE_API_KEY)
gemini_model = genai.GenerativeModel('gemini-pro')
# prompt = "The task is to filter out a set of documents. The documents contains a lot of toxic content all in hindi language. I want to filter them based on the words present in the document. Please list all the toxic and highly sensitive words in hindi language that will help filter this content."
# prompt = 'Generate a list of toxic and banned words in hindi that can be used to filter common crawl data.'
prompt="Give the list of toxic words in hindi"
response = gemini_model.generate_content(prompt,
safety_settings = [
SafetySetting(
category=HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold=HarmBlockThreshold.BLOCK_NONE,
),
SafetySetting(
category=HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold=HarmBlockThreshold.BLOCK_NONE,
),
SafetySetting(
category=HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold=HarmBlockThreshold.BLOCK_NONE,
),
SafetySetting(
category=HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold=HarmBlockThreshold.BLOCK_NONE,
),
])
print(response) |