Skip to content

Commit

Permalink
Entry Js PUBLISH by v3.20230905.915
Browse files Browse the repository at this point in the history
  • Loading branch information
entrydev committed Sep 5, 2023
1 parent 347720e commit 3a4f9d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
35 changes: 27 additions & 8 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -237688,10 +237688,12 @@ var _classPrivateFieldSet2 = _interopRequireDefault(__webpack_require__(21582));
var _InputPopup = _interopRequireDefault(__webpack_require__(22905));
var tf = _interopRequireWildcard(__webpack_require__(7727));
var _videoUtils = _interopRequireDefault(__webpack_require__(18710));
var _mediaPipeUtils = _interopRequireDefault(__webpack_require__(27374));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
var mediaPipeUtils = _mediaPipeUtils["default"].getInstance();
var classes = ['ai_learning_image'];
exports.classes = classes;
var SCALAR_VALUE = 127.5;
Expand Down Expand Up @@ -237796,6 +237798,17 @@ var ImageLearning = /*#__PURE__*/function () {
}));
(0, _classPrivateFieldGet3["default"])(this, _popup).open();
}
}, {
key: "getVideo",
value: function getVideo() {
if (_videoUtils["default"].isInitialized) {
return _videoUtils["default"].video;
}
if (mediaPipeUtils.isInitialized) {
return mediaPipeUtils.video;
}
return null;
}
}, {
key: "startPredict",
value: function () {
Expand All @@ -237818,31 +237831,37 @@ var ImageLearning = /*#__PURE__*/function () {
(0, _classPrivateFieldGet3["default"])(this, _captureCanvas).height = SIZE;
}
(0, _classPrivateFieldSet2["default"])(this, _captureTimeoutClear, Entry.Utils.asyncAnimationFrame( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
var source, context, tensor, logits;
var video, context, tensor, logits;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
source = Entry.stage.canvas.canvas;
video = _this3.getVideo();
if (video) {
_context.next = 3;
break;
}
return _context.abrupt("return");
case 3:
context = (0, _classPrivateFieldGet3["default"])(_this3, _captureCanvas).getContext('2d');
context.drawImage(source, 0, 0);
context.drawImage(video, 0, 0, SIZE, SIZE);
tf.engine().startScope();
_context.next = 6;
_context.next = 8;
return _this3.preprocess((0, _classPrivateFieldGet3["default"])(_this3, _captureCanvas));
case 6:
case 8:
tensor = _context.sent;
logits = _this3.model.predict(tensor);
_context.t0 = _classPrivateFieldSet2["default"];
_context.t1 = _this3;
_context.t2 = _result;
_context.next = 13;
_context.next = 15;
return _this3.namePredictions(logits);
case 13:
case 15:
_context.t3 = _context.sent;
(0, _context.t0)(_context.t1, _context.t2, _context.t3);
logits.dispose();
tf.engine().endScope();
case 17:
case 19:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/entry.min.js

Large diffs are not rendered by default.

0 comments on commit 3a4f9d2

Please sign in to comment.