Spaces:
Running
Running
Updated space
Browse files- app.py +13 -13
- index.html +6 -2
app.py
CHANGED
@@ -291,18 +291,18 @@ To agree to user consent, please do the followings:
|
|
291 |
if user_message:
|
292 |
messages.append(user_message)
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
|
307 |
response = ""
|
308 |
|
@@ -323,7 +323,7 @@ To agree to user consent, please do the followings:
|
|
323 |
|
324 |
loadModels();checkModels();loadENV();
|
325 |
|
326 |
-
lastUpdateMessage = "
|
327 |
demo = gr.ChatInterface(
|
328 |
respond,
|
329 |
title="GPT-4O-mini",
|
|
|
291 |
if user_message:
|
292 |
messages.append(user_message)
|
293 |
|
294 |
+
mode = moderate(messages)
|
295 |
+
if mode:
|
296 |
+
reasons = []
|
297 |
+
categories = mode[0].get('categories', {}) if isinstance(mode, list) else mode.get('categories', {})
|
298 |
+
for category, flagged in categories.items():
|
299 |
+
if flagged:
|
300 |
+
reasons.append(category)
|
301 |
+
if reasons:
|
302 |
+
yield "[MODERATION] I'm sorry, but I can't assist with that.\n\nReasons:\n```\n" + "\n".join([f"{i+1}. {reason}" for i, reason in enumerate(reasons)]) + "\n```"
|
303 |
+
else:
|
304 |
+
yield "[MODERATION] I'm sorry, but I can't assist with that."
|
305 |
+
return
|
306 |
|
307 |
response = ""
|
308 |
|
|
|
323 |
|
324 |
loadModels();checkModels();loadENV();
|
325 |
|
326 |
+
lastUpdateMessage = "Turned on the old moderation system."
|
327 |
demo = gr.ChatInterface(
|
328 |
respond,
|
329 |
title="GPT-4O-mini",
|
index.html
CHANGED
@@ -37,6 +37,10 @@
|
|
37 |
<hr/>
|
38 |
<h2>Updates</h2>
|
39 |
<div>
|
|
|
|
|
|
|
|
|
40 |
<div>
|
41 |
<strong> - 5. Update Rollback.</strong>
|
42 |
<p> * After just a day, the new moderation turns out to be <strong>*extreamly*</strong> strict, so moderation has been paused until i found a better way.</p>
|
@@ -44,7 +48,7 @@
|
|
44 |
</div><hr/>
|
45 |
<div>
|
46 |
<strong> - 5. Update.</strong>
|
47 |
-
<p> * Added extreamly strict moderation
|
48 |
</div><hr/>
|
49 |
<div>
|
50 |
<strong> - 4. Update.</strong>
|
@@ -141,4 +145,4 @@ print(completion.choices[0].message.content)</textarea>
|
|
141 |
CodeMirror.fromTextArea(document.getElementById("example3"), { lineNumbers: true, mode: "shell", theme: "monokai", readOnly: true });
|
142 |
</script>
|
143 |
</body>
|
144 |
-
</html>
|
|
|
37 |
<hr/>
|
38 |
<h2>Updates</h2>
|
39 |
<div>
|
40 |
+
<div>
|
41 |
+
<strong> - 5. Update Rollback (part 2).</strong>
|
42 |
+
<p> * Switched back to old model, as it at least did some enough check</p>
|
43 |
+
</div><hr/>
|
44 |
<div>
|
45 |
<strong> - 5. Update Rollback.</strong>
|
46 |
<p> * After just a day, the new moderation turns out to be <strong>*extreamly*</strong> strict, so moderation has been paused until i found a better way.</p>
|
|
|
48 |
</div><hr/>
|
49 |
<div>
|
50 |
<strong> - 5. Update.</strong>
|
51 |
+
<p> * Added extreamly strict moderation.</p>
|
52 |
</div><hr/>
|
53 |
<div>
|
54 |
<strong> - 4. Update.</strong>
|
|
|
145 |
CodeMirror.fromTextArea(document.getElementById("example3"), { lineNumbers: true, mode: "shell", theme: "monokai", readOnly: true });
|
146 |
</script>
|
147 |
</body>
|
148 |
+
</html>
|