Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import discord
|
2 |
import google.generativeai as genai
|
|
|
3 |
import gradio as gr
|
4 |
import threading
|
5 |
import os
|
@@ -96,7 +97,14 @@ async def on_message(message):
|
|
96 |
refresh()
|
97 |
else:
|
98 |
# Generate message
|
99 |
-
response = chat.send_message(requester_name + ": \"" +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
if response and response.text:
|
102 |
|
|
|
1 |
import discord
|
2 |
import google.generativeai as genai
|
3 |
+
from google.generativeai.types import HarmCategory, HarmBlockThreshold
|
4 |
import gradio as gr
|
5 |
import threading
|
6 |
import os
|
|
|
97 |
refresh()
|
98 |
else:
|
99 |
# Generate message
|
100 |
+
response = chat.send_message(requester_name + ": \"" +user_message+"\"",
|
101 |
+
safety_settings={
|
102 |
+
HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,
|
103 |
+
HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
|
104 |
+
HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
|
105 |
+
HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE
|
106 |
+
}
|
107 |
+
)
|
108 |
|
109 |
if response and response.text:
|
110 |
|