Skip to content

Commit fd78899

Browse files
committed
remove nsfw filter for now
1 parent fb77ce1 commit fd78899

File tree

3 files changed

+45
-36
lines changed

3 files changed

+45
-36
lines changed

electron_app/src/StableDiffusion.vue

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
import { send_to_py } from "./py_vue_bridge.js"
77
import {get_tokens} from './clip_tokeniser/clip_encoder.js'
8-
const nsfwjs = require('nsfwjs');
8+
99
1010
function remove_non_ascii(str) {
1111
@@ -49,39 +49,48 @@ export default {
4949
if(msg_code == "inwk"){
5050
this.is_input_avail = false;
5151
}
52+
53+
// removing the nsfw thing as it does not run in m1 build
54+
// if(msg_code == "nwim"){
55+
// let impath = msg.substring(5).trim()
56+
57+
// const img = new Image();
58+
// img.src = "file://" + impath;
59+
60+
// img.attached_cbs = this.attached_cbs;
61+
62+
// // check for nsfw content
63+
// img.onload = () => {
64+
// if (this.$parent.app_state.app_data.settings.nsfw_filter == true) {
65+
// if (img.attached_cbs) {
66+
// if (img.attached_cbs.on_img)
67+
// img.attached_cbs.on_img(impath);
68+
// }
69+
// }
70+
// else {
71+
// const nsfwjs = require('nsfwjs');
72+
// nsfwjs.load()
73+
// .then(model => model.classify(img))
74+
// .catch(() => {
75+
// console.log("cant run nsfw")
76+
// })
77+
// .then(predictions => {
78+
// if (predictions && (predictions[0].className == 'Hentai' || predictions[0].className == 'Porn')) {
79+
// impath = "nsfw_" + Math.random();
80+
// }
81+
// if (img.attached_cbs) {
82+
// if (img.attached_cbs.on_img)
83+
// img.attached_cbs.on_img(impath);
84+
// }
85+
// });
86+
// }
87+
// }
88+
// }
5289
if(msg_code == "nwim"){
5390
let impath = msg.substring(5).trim()
54-
55-
const img = new Image();
56-
img.src = "file://" + impath;
57-
58-
img.attached_cbs = this.attached_cbs;
59-
60-
// check for nsfw content
61-
img.onload = () => {
62-
if (this.$parent.app_state.app_data.settings.nsfw_filter == true) {
63-
if (img.attached_cbs) {
64-
if (img.attached_cbs.on_img)
65-
img.attached_cbs.on_img(impath);
66-
}
67-
}
68-
else {
69-
70-
nsfwjs.load()
71-
.then(model => model.classify(img))
72-
.catch(() => {
73-
console.log("cant run nsfw")
74-
})
75-
.then(predictions => {
76-
if (predictions && (predictions[0].className == 'Hentai' || predictions[0].className == 'Porn')) {
77-
impath = "nsfw_" + Math.random();
78-
}
79-
if (img.attached_cbs) {
80-
if (img.attached_cbs.on_img)
81-
img.attached_cbs.on_img(impath);
82-
}
83-
});
84-
}
91+
if(this.attached_cbs){
92+
if(this.attached_cbs.on_img)
93+
this.attached_cbs.on_img(impath);
8594
}
8695
}
8796

electron_app/src/background.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ protocol.registerSchemesAsPrivileged([
2626
])
2727

2828

29-
import {menu_template} from "./menu_template"
30-
Menu.setApplicationMenu(Menu.buildFromTemplate(menu_template))
29+
// import {menu_template} from "./menu_template"
30+
// Menu.setApplicationMenu(Menu.buildFromTemplate(menu_template))
3131

3232
start_bridge();
3333

electron_app/src/components/Settings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div v-if="!is_custom_model_loading">
55
<h1>Settings</h1>
66
<br>
7-
<h2>General Settings</h2>
7+
<!-- <h2>General Settings</h2>
88
<br>
99
<div class="setting_box">
1010
<div class="settings_left">
@@ -19,7 +19,7 @@
1919
</label>
2020
</div>
2121
</div>
22-
<hr>
22+
<hr> -->
2323
<div class="l_button button_colored" style="float:right" @click="add_model" >Add New Model</div>
2424
<h2>Custom Models</h2>
2525

0 commit comments

Comments
 (0)