Skip to content

Commit

Permalink
revert: revert "chore(nsfw): update nsfw model"
Browse files Browse the repository at this point in the history
This reverts commit e0c423d.
  • Loading branch information
dev-737 committed Mar 8, 2024
1 parent e0c423d commit 8840632
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 122 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.105.0",
"@sentry/node": "^7.104.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": "^4.1.0",
"nsfwjs": "^3.0.0",
"parse-duration": "^1.1.0",
"sharp": "^0.33.2",
"source-map-support": "^0.5.21",
"winston": "^3.12.0"
"winston": "^3.11.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.25",
"@types/node": "^20.11.24",
"@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.4.2",
"typescript-eslint": "^7.1.1"
"typescript": "^5.3.3",
"typescript-eslint": "^7.1.0"
},
"config": {
"commitizen": {
Expand Down
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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 added src/api/public/model/group1-shard1of1
Binary file not shown.
1 change: 1 addition & 0 deletions src/api/public/model/model.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion 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';

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

const imageToTensor = async (rawImageData: ArrayBuffer) => {
Expand All @@ -28,6 +28,8 @@ 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: 1 addition & 0 deletions src/commands/slash/Main/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ 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 8840632

Please sign in to comment.