Saurabhgk18 commited on
Commit
2cce082
1 Parent(s): ee8eed3

Updated SaftyNet

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -12,8 +12,27 @@ load_dotenv() ## load all our environment variables
12
 
13
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  def response(input, pdf, prompt):
16
- model = genai.GenerativeModel('gemini-pro-vision')
17
  response = model.generate_content([input, pdf[0], prompt])
18
  return response.text
19
 
 
12
 
13
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
14
 
15
+ safety_settings = [
16
+ {
17
+ "category": "HARM_CATEGORY_HARASSMENT",
18
+ "threshold": "BLOCK_ONLY_HIGH"
19
+ },
20
+ {
21
+ "category": "HARM_CATEGORY_HATE_SPEECH",
22
+ "threshold": "BLOCK_ONLY_HIGH"
23
+ },
24
+ {
25
+ "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
26
+ "threshold": "BLOCK_ONLY_HIGH"
27
+ },
28
+ {
29
+ "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
30
+ "threshold": "BLOCK_ONLY_HIGH"
31
+ },
32
+ ]
33
+
34
  def response(input, pdf, prompt):
35
+ model = genai.GenerativeModel('gemini-pro-vision', safety_settings=safety_settings)
36
  response = model.generate_content([input, pdf[0], prompt])
37
  return response.text
38