Skip to content

Commit

Permalink
chore(nsfw): update nsfw model
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Mar 8, 2024
1 parent b225da6 commit e0c423d
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 127 deletions.
2 changes: 1 addition & 1 deletion locales
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "module",
"dependencies": {
"@prisma/client": "^5.10.2",
"@sentry/node": "^7.104.0",
"@sentry/node": "^7.105.0",
"@tensorflow/tfjs-node": "^4.17.0",
"@top-gg/sdk": "^3.1.6",
"common-tags": "^1.8.2",
Expand All @@ -33,11 +33,11 @@
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"lz-string": "^1.5.0",
"nsfwjs": "^3.0.0",
"nsfwjs": "^4.1.0",
"parse-duration": "^1.1.0",
"sharp": "^0.33.2",
"source-map-support": "^0.5.21",
"winston": "^3.11.0"
"winston": "^3.12.0"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^1.6.3",
Expand All @@ -46,7 +46,7 @@
"@types/i18n": "^0.13.10",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.24",
"@types/node": "^20.11.25",
"@types/source-map-support": "^0.5.10",
"cz-conventional-changelog": "^3.3.0",
"eslint": "8.57.0",
Expand All @@ -56,8 +56,8 @@
"prisma": "^5.10.2",
"standard-version": "^9.5.0",
"tsc-watch": "^6.0.4",
"typescript": "^5.3.3",
"typescript-eslint": "^7.1.0"
"typescript": "^5.4.2",
"typescript-eslint": "^7.1.1"
},
"config": {
"commitizen": {
Expand Down
1 change: 0 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import nsfwRouter from './routes/nsfw.js';
export const startApi = (data: { voteManager: VoteManager }) => {
const app = express();

app.use(express.static('src/api/public'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(nsfwRouter);
Expand Down
Binary file removed src/api/public/model/group1-shard1of1
Binary file not shown.
1 change: 0 additions & 1 deletion src/api/public/model/model.json

This file was deleted.

4 changes: 1 addition & 3 deletions src/api/routes/nsfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Logger from '../../utils/Logger.js';
import sharp from 'sharp';
import jpeg from 'jpeg-js';

let nsfwModel;
const nsfwModel = await load('MobileNetV2');
const router: Router = Router();

const imageToTensor = async (rawImageData: ArrayBuffer) => {
Expand All @@ -28,8 +28,6 @@ const imageToTensor = async (rawImageData: ArrayBuffer) => {
};

router.get('/nsfw', async (req, res) => {
nsfwModel = await load('http://localhost:443/model/');

const url = new URL(req.url, `http://${req.headers.host}`);
const imageUrl = url.searchParams.get('url');

Expand Down
1 change: 0 additions & 1 deletion src/commands/slash/Main/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export default class Connection extends BaseCommand {
components: [customizeMenu, buttons],
});

// TODO Button expiration
setComponentExpiry(
interaction.client.getScheduler(),
await interaction.fetchReply(),
Expand Down
Loading

0 comments on commit e0c423d

Please sign in to comment.