Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -95,29 +95,29 @@ def Genration():
|
|
95 |
try:
|
96 |
import google.generativeai as genai
|
97 |
generation_config = {
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
}
|
103 |
|
104 |
safety_settings = [
|
105 |
-
|
106 |
"category": "HARM_CATEGORY_HARASSMENT",
|
107 |
-
"threshold": "
|
108 |
-
|
109 |
-
|
110 |
"category": "HARM_CATEGORY_HATE_SPEECH",
|
111 |
-
"threshold": "
|
112 |
-
|
113 |
-
|
114 |
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
115 |
-
"threshold": "
|
116 |
-
|
117 |
-
|
118 |
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
|
119 |
-
"threshold": "
|
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': "
|
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)
|