Cuckoo donkey AI short video face-swapping applet source code building tutorial

Cuckoo donkey AI short video one-click face-changing applet source code / build tutorial with traffic master

Source code download

https://github.com/peizhou/faceoff

After downloading the source code locally, modify the appid

Modify it to your own WeChat applet, open /dist/pages/ele/index.js

insert image description here

Configure WeChat applet request domain name

insert image description here

Manage background configuration

insert image description here
insert image description here
insert image description here
insert image description here

core code

(wx.webpackJsonp = wx.webpackJsonp || []).push([ [ 38 ], {
    274: function(e, c, a) {
        e.exports = a.p + "assets/face_delete.png";
    },
    433: function(e, c, a) {
        "use strict";
        a.r(c);
        var t = a(7), n = a(2), s = a.n(n), i = a(5), r = a(19), o = a(1), j = a(71), f = a.n(j), l = a(151), _ = a.n(l), b = a(274), u = a.n(b), p = a(20), O = a(22), d = a(90), h = a(111), m = a(155), g = a(110), x = a(4), w = a.n(x), v = a(8), N = a(152), k = a(66), C = a(18), A = a(0), F = function() {
            var e = Object(O.c)(function(e) {
                return e.face;
            }), c = Object(O.b)();
            Object(C.c)({
                type: "app"
            });
            var a, t, n, j, l = "", b = function() {
                t && t();
            }, x = function() {
                var e = Object(i.a)(s.a.mark(function e(a, t) {
                    var n;
                    return s.a.wrap(function(e) {
                        for (;;) switch (e.prev = e.next) {
                          case 0:
                            return "camera" === a && Object(k.a)(500), Object(v.d)(), e.next = 4, Object(g.a)(a, t);

                          case 4:
                            0 == (n = e.sent).code ? (c(Object(d.c)(n.data)), Object(v.c)(), w.a.navigateTo({
                                url: "/pages/preview/index",
                                success: function() {
                                    j && j();
                                }
                            })) : (Object(v.c)(), 1 == n.code && Object(v.b)(n.err));

                          case 6:
                          case "end":
                            return e.stop();
                        }
                    }, e);
                }));
                return function(c, a) {
                    return e.apply(this, arguments);
                };
            }();
            return Object(A.jsxs)(r.b, {
                className: f.a.face_manager,
                children: [ Object(A.jsxs)(o.j, {
                    className: f.a.container,
                    children: [ Object(A.jsx)(o.j, {
                        className: f.a.add,
                        onClick: function() {
                            n && n();
                        },
                        children: Object(A.jsx)(o.j, {
                            className: f.a.content,
                            children: Object(A.jsx)(o.c, {
                                className: f.a.image,
                                mode: "aspectFit",
                                src: _.a
                            })
                        })
                    }), e.items.map(function(e) {
                        return Object(A.jsxs)(o.j, {
                            className: f.a.item,
                            children: [ Object(A.jsx)(N.a, {
                                stateClassName: f.a.content,
                                src: Object(p.b)(e.sign),
                                width: e.width,
                                height: e.height,
                                viewWidth: 140,
                                viewHeight: 140,
                                focus: e.focus
                            }, e.sign), Object(A.jsx)(o.j, {
                                className: f.a.delete,
                                onClick: function() {
                                    l = e.sign, a && a();
                                },
                                children: Object(A.jsx)(o.c, {
                                    className: f.a.image,
                                    mode: "aspectFit",
                                    src: u.a
                                })
                            }) ]
                        });
                    }) ]
                }), Object(A.jsx)(h.a, {
                    title: "确定要删除头像吗?",
                    texts: [ "删除头像后,您上传的照片将从服务器删除" ],
                    textAlignment: "center",
                    ok: "确定",
                    cancel: "取消",
                    fnAlertOpen: function(e) {
                        a = e;
                    },
                    fnAlertClose: function(e) {
                        t = e;
                    },
                    onAlertOk: function() {
                        b(), c(Object(d.b)(l));
                    },
                    onAlertCancel: function() {
                        b();
                    }
                }), Object(A.jsx)(m.a, {
                    title: "选择人脸图像",
                    showFaceChoose: !1,
                    showFacePicker: !0,
                    showFaceOptions: !1,
                    onPickerChanged: x,
                    fnFaceOpen: function(e) {
                        n = e;
                    },
                    fnFaceClose: function(e) {
                        j = e;
                    }
                }) ]
            });
        };
        F.enableShareTimeline = !0, F.enableShareAppMessage = !0, Page(Object(t.createPageConfig)(F, "pages/user/face", {
            root: {
                cn: []
            }
        }, {
            navigationBarTitleText: "人像管理",
            enableShareAppMessage: !0,
            enableShareTimeline: !0
        } || {}));
    },
    71: function(e, c, a) {
        e.exports = {
            face_manager: "face__face_manager___3Rezt",
            container: "face__container___1hyRh",
            add: "face__add___cANTz",
            content: "face__content___ZLj8f",
            image: "face__image___XehEj",
            item: "face__item___1OdsW",
            delete: "face__delete___lqczP"
        };
    }
}, [ [ 433, 0, 1, 2, 3 ] ] ]);

Guess you like

Origin blog.csdn.net/faceplay1/article/details/126653748