NotASI commited on
Commit
7dfd8ee
·
1 Parent(s): 58409f1

Attempt to overcome censorship that block every a safe prompt

Browse files
Files changed (2) hide show
  1. Tabs/Gemini_Chabot_Nightly.py +18 -6
  2. app.py +18 -6
Tabs/Gemini_Chabot_Nightly.py CHANGED
@@ -24,12 +24,24 @@ Known errors ⚠️:
24
  genai.configure(api_key=GEMINI_API_KEY_NIGHTLY)
25
  model = genai.GenerativeModel(
26
  model_name,
27
- safety_settings={
28
- HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
29
- HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,
30
- HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
31
- HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
32
- },
 
 
 
 
 
 
 
 
 
 
 
 
33
  generation_config={
34
  "temperature": 1,
35
  "top_p": 0.95,
 
24
  genai.configure(api_key=GEMINI_API_KEY_NIGHTLY)
25
  model = genai.GenerativeModel(
26
  model_name,
27
+ safety_settings=[
28
+ {
29
+ "catergory": "HARM_CATEGORY_HARASSMENT",
30
+ "threshold": "BLOCK_NONE"
31
+ },
32
+ {
33
+ "catergory": "HARM_CATEGORY_HATE_SPEECH",
34
+ "threshold": "BLOCK_NONE"
35
+ },
36
+ {
37
+ "catergory": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
38
+ "threshold": "BLOCK_NONE"
39
+ },
40
+ {
41
+ "catergory": "HARM_CATEGORY_DANGEROUS_CONTENT",
42
+ "threshold": "BLOCK_NONE"
43
+ }
44
+ ],
45
  generation_config={
46
  "temperature": 1,
47
  "top_p": 0.95,
app.py CHANGED
@@ -89,12 +89,24 @@ def bot(
89
  model_name = "gemini-1.5-flash"
90
  model = genai.GenerativeModel(
91
  model_name,
92
- safety_settings={
93
- HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
94
- HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,
95
- HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
96
- HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
97
- },
 
 
 
 
 
 
 
 
 
 
 
 
98
  generation_config=generation_config
99
  )
100
  inputs = [text_prompt] if image_prompt is None else [
 
89
  model_name = "gemini-1.5-flash"
90
  model = genai.GenerativeModel(
91
  model_name,
92
+ safety_settings=[
93
+ {
94
+ "catergory": "HARM_CATEGORY_HARASSMENT",
95
+ "threshold": "BLOCK_NONE"
96
+ },
97
+ {
98
+ "catergory": "HARM_CATEGORY_HATE_SPEECH",
99
+ "threshold": "BLOCK_NONE"
100
+ },
101
+ {
102
+ "catergory": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
103
+ "threshold": "BLOCK_NONE"
104
+ },
105
+ {
106
+ "catergory": "HARM_CATEGORY_DANGEROUS_CONTENT",
107
+ "threshold": "BLOCK_NONE"
108
+ }
109
+ ],
110
  generation_config=generation_config
111
  )
112
  inputs = [text_prompt] if image_prompt is None else [