DIVY118 commited on
Commit
cc0da15
·
verified ·
1 Parent(s): e28e11a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -95,29 +95,29 @@ def Genration():
95
  try:
96
  import google.generativeai as genai
97
  generation_config = {
98
- "temperature": 0.7,
99
- "top_p": 1,
100
- "top_k": 1,
101
- "max_output_tokens": 300,
102
  }
103
 
104
  safety_settings = [
105
- {
106
  "category": "HARM_CATEGORY_HARASSMENT",
107
- "threshold": "BLOCK_ONLY_HIGH"
108
- },
109
- {
110
  "category": "HARM_CATEGORY_HATE_SPEECH",
111
- "threshold": "BLOCK_ONLY_HIGH"
112
- },
113
- {
114
  "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
115
- "threshold": "BLOCK_ONLY_HIGH"
116
- },
117
- {
118
  "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
119
- "threshold": "BLOCK_ONLY_HIGH"
120
- },
121
  ]
122
 
123
  model = genai.GenerativeModel(
@@ -140,9 +140,9 @@ def Genration():
140
  'execution_time': t()-C
141
  }
142
  return jsonify(result)
143
- except:
144
  result = {
145
- 'response': "I'm here to provide information and assistance in a respectful manner. Inappropriate or offensive language is not acceptable. If you have a different question or topic you'd like help with, please feel free to ask, and I'll do my best to assist you.",
146
  'execution_time': t()-C
147
  }
148
  return jsonify(result)
 
95
  try:
96
  import google.generativeai as genai
97
  generation_config = {
98
+ "temperature": 0.7,
99
+ "top_p": 1,
100
+ "top_k": 1,
101
+ "max_output_tokens": 300,
102
  }
103
 
104
  safety_settings = [
105
+ {
106
  "category": "HARM_CATEGORY_HARASSMENT",
107
+ "threshold": "BLOCK_NONE"
108
+ },
109
+ {
110
  "category": "HARM_CATEGORY_HATE_SPEECH",
111
+ "threshold": "BLOCK_NONE"
112
+ },
113
+ {
114
  "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
115
+ "threshold": "BLOCK_NONE"
116
+ },
117
+ {
118
  "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
119
+ "threshold": "BLOCK_NONE"
120
+ },
121
  ]
122
 
123
  model = genai.GenerativeModel(
 
140
  'execution_time': t()-C
141
  }
142
  return jsonify(result)
143
+ except Exception as e:
144
  result = {
145
+ 'response': f"{e}",
146
  'execution_time': t()-C
147
  }
148
  return jsonify(result)