Merge branch 'master' of https://bdgit.educoder.net/ptinqsey9/for_you into zimujun_branch

pull/13/head
zimujun20 2 years ago
commit 68ca5a6585

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -31,10 +31,12 @@
**前置条件**app正常运行
**基本事件流**
1、用户打开手语翻译app
2、用户点击输入框
3、用户输入自然语言
4、用户提交自然语言
1、用户打开手语翻译app
2、app跳转到主页面
3、用户点击输入框
4、用户输入自然语言
5、用户提交自然语言
6、app接收自然语言
**扩展交互动作**
1a: 修改输入内容
@ -53,10 +55,12 @@
**前置条件**app正常运行
**基本事件流**
1、用户打开手语翻译app
2、用户允许app开启摄像头
3、用户打开摄像头
4、app获取摄像头视频流
1、用户打开手语翻译app
2、app跳转到主页面
3、app提示是否打开摄像头
4、用户允许app开启摄像头
5、用户打开摄像头
6、app获取摄像头视频流
**扩展交互动作**
1a: 重新录制视频
@ -75,10 +79,12 @@
**前置条件**
1、网络正常连接或本地算力足够
2、用户已输入自然语言
**基本事件流**
1、用户点击“语言翻译”按钮
2、app对获取自然语言进行翻译
2、app对获取自然语言进行翻译
3、app提示翻译成功
**扩展交互动作**
1a: 选择本地运算或云端运算
@ -99,10 +105,13 @@
**前置条件**
1、网络正常连接或本地算力足够
2、用户已输入视频
**基本事件流**
1、用户点击“视频翻译”按钮
2、app对视频进行翻译
1、用户点击“视频翻译”按钮
2、app显示正在翻译
3、app对视频进行翻译
4、app显示翻译成功
**扩展交互动作**
1a: 选择本地运算或云端运算
@ -122,7 +131,8 @@
**执行者**:用户
**前置条件**app已经获取3D动画数据
**基本事件流**
1、app显示生成3D动画
1、用户点击“翻译自然语言”按钮
2、app显示生成3D动画
**后置条件**:当动画生成后,在屏幕指定位置展示动画
@ -135,7 +145,8 @@
**执行者**:用户
**前置条件**app已经获取处理后的自然语言
**基本事件流**
1、app显示翻译后的自然语言
1、用户点击“翻译手语动画”按钮
2、app显示翻译后的自然语言
**后置条件**:当收到自然语言时,在屏幕指定位置生成文字

Binary file not shown.

Binary file not shown.

@ -1,5 +0,0 @@
module main.go
go 1.19
require github.com/mattn/go-sqlite3 v1.14.15 // indirect

@ -1,2 +0,0 @@
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,19 +0,0 @@
import (
"fmt"
"log"
"net/http"
"webserver/routers"
)
func main() {
endPoint := fmt.Sprintf("0.0.0.0:%d", 8000)
server := &http.Server{
Addr: endPoint,
Handler: routers.InitRouter(),
}
log.Printf("[info] start http server listening %s", endPoint)
if err := server.ListenAndServe(); err != nil {
log.Printf("start http server failed %s", err)
}
}

@ -0,0 +1,86 @@
package api
import (
"database/sql"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"net"
"net/http"
"strconv"
"time"
app "webserver/pkg/app"
)
// 获取本设备的mac地址
func getMacAddress() (macAddress string) {
netInterfaces, err := net.Interfaces()
if err != nil {
fmt.Printf("fail to get net interfaces: %v", err)
return macAddress
}
for _, netInterface := range netInterfaces {
if netInterface.Name == "WLAN" {
macAddress := netInterface.HardwareAddr
return macAddress.String()
}
}
return macAddress
}
// 获取本设备的IP地址
func getIpAddress() (addr string, err error) {
var (
ief *net.Interface
addrs []net.Addr
ipv4Addr net.IP
)
if ief, err = net.InterfaceByName("WLAN"); err != nil {
return
}
if addrs, err = ief.Addrs(); err != nil {
return
}
for _, addr := range addrs {
if ipv4Addr = addr.(*net.IPNet).IP.To4(); ipv4Addr != nil {
break
}
}
if ipv4Addr == nil {
return "", errors.New(fmt.Sprintf("interface WLAN don't have an ipv4 address\n"))
}
return ipv4Addr.String(), nil
}
// 向服务器发送本设备的mac地址和IP地址
func SendAddress(c *gin.Context) {
appG := app.Gin{C: c}
now := time.Now()
hour := now.Hour()
minute := now.Minute()
t := hour*100 + minute
macAddress := getMacAddress()
ipAddress, err := getIpAddress()
if err != nil {
fmt.Println(err)
}
db, err := sql.Open("sqlite3", "info2.db")
if err != nil {
fmt.Println(err)
}
defer db.Close()
rows, err := db.Query(`select macAddress from Endpoint where macAddress = ?;`, macAddress)
defer rows.Close()
var endpoint Endpoint
rows.Next()
rows.Scan(&endpoint.macAddress)
if endpoint.macAddress == "" {
db.Exec(`insert into Endpoint values (?,?,?,?);`, macAddress, ipAddress, 0, t)
} else {
db.Exec(`update Endpoint set ipAddress = ? where macAddress = ?;`, ipAddress, macAddress)
db.Exec(`update Endpoint set isOnLine = ? where macAddress = ?;`, t, macAddress)
}
str := "time:" + strconv.Itoa(t) + " mac:" + macAddress + " ip:" + ipAddress
appG.Response(http.StatusOK, "true", str)
}

@ -1,92 +0,0 @@
package android
import (
"fmt"
"net"
"database/sql"
"time"
"pkg/app"
"errors"
_ "github.com/mattn/go-sqlite3"
"github.com/gin-gonic/gin"
)
//获取本设备的mac地址
func getMacAddress() (macAddress string) {
netInterfaces, err := net.Interfaces()
if err != nil {
fmt.Printf("fail to get net interfaces: %v", err)
return macAddress
}
for _, netInterface := range netInterfaces {
if ( netInterface.Name == "WLAN" ) {
macAddress := netInterface.HardwareAddr
return macAddress.String()
}
}
return macAddress
}
//获取本设备的IP地址
func getIpAddress() (addr string, err error) {
var (
ief *net.Interface
addrs []net.Addr
ipv4Addr net.IP
)
if ief, err = net.InterfaceByName("WLAN"); err != nil {
return
}
if addrs, err = ief.Addrs(); err != nil {
return
}
for _, addr := range addrs {
if ipv4Addr = addr.(*net.IPNet).IP.To4(); ipv4Addr != nil {
break
}
}
if ipv4Addr == nil {
return "", errors.New(fmt.Sprintf("interface WLAN don't have an ipv4 address\n"))
}
return ipv4Addr.String(), nil
}
//向服务器发送本设备的mac地址和IP地址
func sendAddress(c *gin.Context) {
appG := app.Gin{C: c}
now := time.Now()
hour := now.Hour()
minute := now.Minute()
t := hour*100 + minute
macAddress := getMacAddress()
ipAddress, err := getIpAddress()
if err != nil {
fmt.Println(err)
}
db, err := sql.Open("sqlite3", "info.db")
if err != nil {
fmt.Println(err)
}
defer db.Close()
rows, err := db.Query(`select macAddress from Endpoint where macAddress = ?;`, macAddress)
defer rows.Close()
var MacAddress string
rows.Next()
rows.Scan(&MacAddress)
if MacAddress == "" {
db.Exec(`insert into Endpoint values (?,?,?,?);`, macAddress, ipAddress, 0, t)
} else {
db.Exec(`update Endpoint set ipAddress = ? where macAddress = ?;`, ipAddress, macAddress)
db.Exec(`update Endpoint set isOnLine = ? where macAddress = ?;`, t, macAddress)
}
appG.Response(http.StatusOK, "true", null)
}
func mediaPipe(c *gin.Context) {
appG := app.Gin{C: c}
//这里将视频流转化为自然语言
data :=
appG.Response(http.StatusOK, "true", data)
}

@ -1,39 +0,0 @@
package android
import (
"fmt"
"database/sql"
_ "go-sqlite3-master"
"pkg/app"
"github.com/gin-gonic/gin"
)
func updateAverage () {
macAddress = getMacAddress()
db, err := sql.Open("sqlite3", "info.db")
if err != nil {
fmt.Println(err)
}
defer db.Close()
db.Exec(`update Endpoint set times = times + 1 where macAddress = ?;`, macAddress)
rows, err := db.Query(`select SUM( times ) from Endpoint`)
defer rows.Close()
var sumOfTimes int
rows.Next()
rows.Scan(&sumOfTimes)
rows, err = db.Query(`select COUNT( macAddress ) from Endpoint;`)
defer rows.Close()
var countOfMacAddress int
rows.Next()
rows.Scan(&countOfMacAddress)
db.Exec(`update Average set average = ?/?;`sumOfTimes, countOfMacAddress)
}
func wordSend (c *gin.Context) {
appG := app.Gin{C: c}
//这里获取转化好的数据
data := mediaPipe().data
updateAverage()
appG.Response(http.StatusOK, "true", data)
}

@ -1,21 +1,29 @@
package pc
package api
import (
"database/sql"
"fmt"
"github.com/gin-gonic/gin"
_ "github.com/mattn/go-sqlite3"
"time"
"math/rand"
"net/http"
"strings"
"pkg/app"
"time"
app "webserver/pkg/app"
)
//拉取在线的算力设备
type Endpoint struct {
ipAddress string
macAddress string
}
// 拉取在线的算力设备
func ipAddress() []string {
now := time.Now()
hour := now.Hour()
hour := now.Hour()
minute := now.Minute()
t := hour*100 + minute -100
db, err := sql.Open("sqlite3", "info.db")
t := hour*100 + minute - 100
db, err := sql.Open("sqlite3", "info2.db")
if err != nil {
fmt.Println(err)
}
@ -43,8 +51,7 @@ func init() {
rand.Seed(time.Now().UnixNano())
}
//洗牌算法
// 洗牌算法
func shuffle(n []string) {
for i := 0; i < len(n); i++ {
a := rand.Intn(len(n))
@ -53,12 +60,12 @@ func shuffle(n []string) {
}
}
//返回可进行运算的设备地址
func request(c *gin.Contex) []string {
// 返回可进行运算的设备地址
func Request(c *gin.Context) {
appG := app.Gin{C: c}
var ipAddress = ipAddress()
for i := 0; i < 3; i++ {
shuffle(ipAddress)
}
appG.Response(http.StatusOK, "成功", null)
}
appG.Response(http.StatusOK, "成功", ipAddress)
}

@ -0,0 +1,196 @@
package api
import (
"database/sql"
"fmt"
"github.com/gin-gonic/gin"
_ "github.com/mattn/go-sqlite3"
"net/http"
app "webserver/pkg/app"
)
type XYZ struct {
Word string `json:"word"`
}
type TRANSLATION struct {
Word string `json:"word"`
}
type XYZBody struct {
fig00 string
fig01 string
fig02 string
fig03 string
fig04 string
fig05 string
fig06 string
fig07 string
fig08 string
fig09 string
fig10 string
fig11 string
fig12 string
fig13 string
fig14 string
fig15 string
fig16 string
fig17 string
fig18 string
fig19 string
fig20 string
fig21 string
fig22 string
fig23 string
fig24 string
fig25 string
fig26 string
fig27 string
fig28 string
fig29 string
fig30 string
fig31 string
fig32 string
fig33 string
fig34 string
fig35 string
fig36 string
fig37 string
fig38 string
fig39 string
fig40 string
fig41 string
fig42 string
fig43 string
fig44 string
fig45 string
fig46 string
fig47 string
fig48 string
fig49 string
fig50 string
fig51 string
fig52 string
fig53 string
fig54 string
fig55 string
fig56 string
fig57 string
fig58 string
fig59 string
fig60 string
fig61 string
fig62 string
fig63 string
fig64 string
fig65 string
fig66 string
fig67 string
fig68 string
fig69 string
fig70 string
fig71 string
fig72 string
fig73 string
fig74 string
fig75 string
fig76 string
fig77 string
fig78 string
fig79 string
fig80 string
fig81 string
fig82 string
fig83 string
fig84 string
fig85 string
fig86 string
fig87 string
fig88 string
fig89 string
fig90 string
fig91 string
fig92 string
fig93 string
fig94 string
fig95 string
fig96 string
fig97 string
fig98 string
fig99 string
fig100 string
fig101 string
fig102 string
fig103 string
fig104 string
fig105 string
fig106 string
fig107 string
fig108 string
fig109 string
fig110 string
fig111 string
fig112 string
fig113 string
fig114 string
fig115 string
fig116 string
fig117 string
fig118 string
fig119 string
fig120 string
fig121 string
fig122 string
fig123 string
fig124 string
fig125 string
}
func SqliteQueryXYZ(c *gin.Context) {
appG := app.Gin{C: c}
s := c.Query("str")
var str []string
runes := []rune(s)
for i := 0; i < len(runes); i++ {
str = append(str, string(runes[i]))
}
db, err := sql.Open("sqlite3", "info.db")
if err != nil {
fmt.Println(err)
}
defer db.Close()
strs := ""
for i := 0; i < len(str); i++ {
var rows, _ = db.Query(`select fig00, fig01, fig02, fig03, fig04, fig05, fig06, fig07, fig08, fig09, fig10, fig11, fig12, fig13, fig14, fig15, fig16, fig17, fig18, fig19, fig20, fig21, fig22, fig23, fig24, fig25, fig26, fig27, fig28, fig29, fig30, fig31, fig32, fig33, fig34, fig35, fig36, fig37, fig38, fig39, fig40, fig41, fig42, fig43, fig44, fig45, fig46, fig47, fig48, fig49, fig50, fig51, fig52, fig53, fig54, fig55, fig56, fig57, fig58, fig59, fig60, fig61, fig62, fig63, fig64, fig65, fig66, fig67, fig68, fig69,fig70, fig71, fig72, fig73, fig74, fig75, fig76, fig77, fig78, fig79, fig80, fig81, fig82, fig83, fig84, fig85, fig86, fig87, fig88, fig89, fig90, fig91, fig92, fig93, fig94, fig95, fig96, fig97, fig98, fig99, fig100, fig101, fig102, fig103, fig104, fig105, fig106, fig107, fig108, fig109, fig110, fig111, fig112, fig113, fig114, fig115, fig116, fig117, fig118, fig119, fig120, fig121, fig122, fig123, fig124, fig125 from XYZ where word = ?`, str[i])
var body XYZBody
rows.Next()
rows.Scan(&body.fig00, &body.fig01, &body.fig02, &body.fig03, &body.fig04, &body.fig05, &body.fig06, &body.fig07, &body.fig08, &body.fig09, &body.fig10, &body.fig11, &body.fig12, &body.fig13, &body.fig14, &body.fig15, &body.fig16, &body.fig17, &body.fig18, &body.fig19, &body.fig20, &body.fig21, &body.fig22, &body.fig23, &body.fig24, &body.fig25, &body.fig26, &body.fig27, &body.fig28, &body.fig29, &body.fig30, &body.fig31, &body.fig32, &body.fig33, &body.fig34, &body.fig35, &body.fig36, &body.fig37, &body.fig38, &body.fig39, &body.fig40, &body.fig41, &body.fig42, &body.fig43, &body.fig44, &body.fig45, &body.fig46, &body.fig47, &body.fig48, &body.fig49, &body.fig50, &body.fig51, &body.fig52, &body.fig53, &body.fig54, &body.fig55, &body.fig56, &body.fig57, &body.fig58, &body.fig59, &body.fig60, &body.fig61, &body.fig62, &body.fig63, &body.fig64, &body.fig65, &body.fig66, &body.fig67, &body.fig68, &body.fig69, &body.fig70, &body.fig71, &body.fig72, &body.fig73, &body.fig74, &body.fig75, &body.fig76, &body.fig77, &body.fig78, &body.fig79, &body.fig80, &body.fig81, &body.fig82, &body.fig83, &body.fig84, &body.fig85, &body.fig86, &body.fig87, &body.fig88, &body.fig89, &body.fig90, &body.fig91, &body.fig92, &body.fig93, &body.fig94, &body.fig95, &body.fig96, &body.fig97, &body.fig98, &body.fig99, &body.fig100, &body.fig101, &body.fig102, &body.fig103, &body.fig104, &body.fig105, &body.fig106, &body.fig107, &body.fig108, &body.fig109, &body.fig110, &body.fig111, &body.fig112, &body.fig113, &body.fig114, &body.fig115, &body.fig116, &body.fig117, &body.fig118, &body.fig119, &body.fig120, &body.fig121, &body.fig122, &body.fig123, &body.fig124, &body.fig125)
if body.fig00 == "" {
strs += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
} else {
strs += body.fig00 + "," + body.fig01 + "," + body.fig02 + "," + body.fig03 + "," + body.fig04 + "," + body.fig05 + "," + body.fig06 + "," + body.fig07 + "," + body.fig08 + "," + body.fig09 + "," + body.fig10 + "," + body.fig11 + "," + body.fig12 + "," + body.fig13 + "," + body.fig14 + "," + body.fig15 + "," + body.fig16 + "," + body.fig17 + "," + body.fig18 + "," + body.fig19 + "," + body.fig20 + "," + body.fig21 + "," + body.fig22 + "," + body.fig23 + "," + body.fig24 + "," + body.fig25 + "," + body.fig26 + "," + body.fig27 + "," + body.fig28 + "," + body.fig29 + "," + body.fig30 + "," + body.fig31 + "," + body.fig32 + "," + body.fig33 + "," + body.fig34 + "," + body.fig35 + "," + body.fig36 + "," + body.fig37 + "," + body.fig38 + "," + body.fig39 + "," + body.fig40 + "," + body.fig41 + "," + body.fig42 + "," + body.fig43 + "," + body.fig44 + "," + body.fig45 + "," + body.fig46 + "," + body.fig47 + "," + body.fig48 + "," + body.fig49 + "," + body.fig50 + "," + body.fig51 + "," + body.fig52 + "," + body.fig53 + "," + body.fig54 + "," + body.fig55 + "," + body.fig56 + "," + body.fig57 + "," + body.fig58 + "," + body.fig59 + "," + body.fig60 + "," + body.fig61 + "," + body.fig62 + "," + body.fig63 + "," + body.fig64 + "," + body.fig65 + "," + body.fig66 + "," + body.fig67 + "," + body.fig68 + "," + body.fig69 + "," + body.fig70 + "," + body.fig71 + "," + body.fig72 + "," + body.fig73 + "," + body.fig74 + "," + body.fig75 + "," + body.fig76 + "," + body.fig77 + "," + body.fig78 + "," + body.fig79 + "," + body.fig80 + "," + body.fig81 + "," + body.fig82 + "," + body.fig83 + "," + body.fig84 + "," + body.fig85 + "," + body.fig86 + "," + body.fig87 + "," + body.fig88 + "," + body.fig89 + "," + body.fig90 + "," + body.fig91 + "," + body.fig92 + "," + body.fig93 + "," + body.fig94 + "," + body.fig95 + "," + body.fig96 + "," + body.fig97 + "," + body.fig98 + "," + body.fig99 + "," + body.fig100 + "," + body.fig101 + "," + body.fig102 + "," + body.fig103 + "," + body.fig104 + "," + body.fig105 + "," + body.fig106 + "," + body.fig107 + "," + body.fig108 + "," + body.fig109 + "," + body.fig110 + "," + body.fig111 + "," + body.fig112 + "," + body.fig113 + "," + body.fig114 + "," + body.fig115 + "," + body.fig116 + "," + body.fig117 + "," + body.fig118 + "," + body.fig119 + "," + body.fig120 + "," + body.fig121 + "," + body.fig122 + "," + body.fig123 + "," + body.fig124 + "," + body.fig125
}
strs += "|"
rows.Close()
}
appG.Response(http.StatusOK, "true", strs)
}
func SqliteQueryTRANSLATION(c *gin.Context) {
appG := app.Gin{C: c}
s := c.Query("str")
db, err := sql.Open("sqlite3", "info.db")
if err != nil {
fmt.Println(err)
}
defer db.Close()
rows, _ := db.Query(`select word from TRANSLATION where num = ?;`, s)
var str string
rows.Next()
rows.Scan(&str)
rows.Close()
if str == "" {
str = "0"
}
appG.Response(http.StatusOK, "true", str)
}

@ -1,24 +0,0 @@
package pkg
import (
"github.com/gin-gonic/gin"
)
type Gin struct {
C *gin.Context
}
type Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
func (g *Gin) Response(httpCode int, errMsg string, data interface{}) {
g.C.JSON(httpCode, Response{
Code: httpCode,
Msg: errMsg,
Data: data,
})
return
}

@ -1,12 +0,0 @@
package pkg
type Endpoint struct {
macAddress string //设备mac地址
ipAddress string //设备IP地址
times int //贡献算力次数
isOnLine int //设备登录时间
}
type Average struct {
average int //平均使用次数
}

@ -1,34 +0,0 @@
package routers
import (
"net/http"
android "webserver/pkg/api/android"
pc "webserver/pkg/api/pc"
"github.com/gin-gonic/gin"
)
// InitRouter 初始化路由信息
func InitRouter() *gin.Engine {
r := gin.Default()
api := r.Group("/pkg/api")
{
api.GET("/android/hands_3d", android.hands_3d)
api.GET("/android/hands_recegnation", android.hands_recegnation)
api.GET("/android/hands_translation", android.hands_translation)
api.GET("/android/media_camera", android.media_camera)
api.GET("/android/media_pipe", android.media_pipe)
api.GET("/android/word_input", android.word_input)
api.GET("/android/word_recv", android.word_recv)
api.GET("/android/word_send", android.word_send)
api.GET("/android/word_show", android.word_show)
api.GET("/pc/load_alancing", pc.load_alancing)
api.GET("/pc/nginx-rtmp", pc.nginx-rtmp)
api.GET("/pc/webserver", pc.webserver)
}
// 静态文件路由
r.StaticFS("/web", http.Dir("./dist/"))
return r
}

@ -0,0 +1,539 @@
(function() {
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
function n(a) {
var b = 0;
return function() {
return b < a.length ? {
done: !1,
value: a[b++]
} : {
done: !0
}
}
}
var q = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, e) {
if (a == Array.prototype || a == Object.prototype) return a;
a[b] = e.value;
return a
};
function t(a) {
a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global];
for (var b = 0; b < a.length; ++b) {
var e = a[b];
if (e && e.Math == Math) return e
}
throw Error("Cannot find global object");
}
var u = t(this);
function v(a, b) {
if (b) a: {
var e = u;a = a.split(".");
for (var f = 0; f < a.length - 1; f++) {
var h = a[f];
if (!(h in e)) break a;
e = e[h]
}
a = a[a.length - 1];f = e[a];b = b(f);b != f && null != b && q(e, a, {
configurable: !0,
writable: !0,
value: b
})
}
}
v("Symbol", function(a) {
function b(l) {
if (this instanceof b) throw new TypeError("Symbol is not a constructor");
return new e(f + (l || "") + "_" + h++, l)
}
function e(l, c) {
this.g = l;
q(this, "description", {
configurable: !0,
writable: !0,
value: c
})
}
if (a) return a;
e.prototype.toString = function() {
return this.g
};
var f = "jscomp_symbol_" + (1E9 * Math.random() >>> 0) + "_",
h = 0;
return b
});
v("Symbol.iterator", function(a) {
if (a) return a;
a = Symbol("Symbol.iterator");
for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), e = 0; e < b.length; e++) {
var f = u[b[e]];
"function" === typeof f && "function" != typeof f.prototype[a] && q(f.prototype, a, {
configurable: !0,
writable: !0,
value: function() {
return w(n(this))
}
})
}
return a
});
function w(a) {
a = {
next: a
};
a[Symbol.iterator] = function() {
return this
};
return a
}
function x(a) {
var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
return b ? b.call(a) : {
next: n(a)
}
}
function y() {
this.i = !1;
this.g = null;
this.o = void 0;
this.j = 1;
this.m = 0;
this.h = null
}
function z(a) {
if (a.i) throw new TypeError("Generator is already running");
a.i = !0
}
y.prototype.l = function(a) {
this.o = a
};
function A(a, b) {
a.h = {
F: b,
G: !0
};
a.j = a.m
}
y.prototype.return = function(a) {
this.h = {
return: a
};
this.j = this.m
};
function B(a) {
this.g = new y;
this.h = a
}
function C(a, b) {
z(a.g);
var e = a.g.g;
if (e) return D(a, "return" in e ? e["return"] : function(f) {
return {
value: f,
done: !0
}
}, b, a.g.return);
a.g.return(b);
return H(a)
}
function D(a, b, e, f) {
try {
var h = b.call(a.g.g, e);
if (!(h instanceof Object)) throw new TypeError("Iterator result " + h + " is not an object");
if (!h.done) return a.g.i = !1, h;
var l = h.value
} catch (c) {
return a.g.g = null, A(a.g, c), H(a)
}
a.g.g = null;
f.call(a.g, l);
return H(a)
}
function H(a) {
for (; a.g.j;) try {
var b = a.h(a.g);
if (b) return a.g.i = !1, {
value: b.value,
done: !1
}
} catch (e) {
a.g.o = void 0, A(a.g, e)
}
a.g.i = !1;
if (a.g.h) {
b = a.g.h;
a.g.h = null;
if (b.G) throw b.F;
return {
value: b.return,
done: !0
}
}
return {
value: void 0,
done: !0
}
}
function I(a) {
this.next = function(b) {
z(a.g);
a.g.g ? b = D(a, a.g.g.next, b, a.g.l) : (a.g.l(b), b = H(a));
return b
};
this.throw = function(b) {
z(a.g);
a.g.g ? b = D(a, a.g.g["throw"], b, a.g.l) : (A(a.g, b), b = H(a));
return b
};
this.return = function(b) {
return C(a, b)
};
this[Symbol.iterator] = function() {
return this
}
}
function J(a) {
function b(f) {
return a.next(f)
}
function e(f) {
return a.throw(f)
}
return new Promise(function(f, h) {
function l(c) {
c.done ? f(c.value) : Promise.resolve(c.value).then(b, e).then(l, h)
}
l(a.next())
})
}
v("Promise", function(a) {
function b(c) {
this.h = 0;
this.i = void 0;
this.g = [];
this.o = !1;
var d = this.j();
try {
c(d.resolve, d.reject)
} catch (g) {
d.reject(g)
}
}
function e() {
this.g = null
}
function f(c) {
return c instanceof b ? c : new b(function(d) {
d(c)
})
}
if (a) return a;
e.prototype.h = function(c) {
if (null == this.g) {
this.g = [];
var d = this;
this.i(function() {
d.l()
})
}
this.g.push(c)
};
var h = u.setTimeout;
e.prototype.i = function(c) {
h(c, 0)
};
e.prototype.l = function() {
for (; this.g && this.g.length;) {
var c = this.g;
this.g = [];
for (var d = 0; d < c.length; ++d) {
var g =
c[d];
c[d] = null;
try {
g()
} catch (k) {
this.j(k)
}
}
}
this.g = null
};
e.prototype.j = function(c) {
this.i(function() {
throw c;
})
};
b.prototype.j = function() {
function c(k) {
return function(m) {
g || (g = !0, k.call(d, m))
}
}
var d = this,
g = !1;
return {
resolve: c(this.A),
reject: c(this.l)
}
};
b.prototype.A = function(c) {
if (c === this) this.l(new TypeError("A Promise cannot resolve to itself"));
else if (c instanceof b) this.C(c);
else {
a: switch (typeof c) {
case "object":
var d = null != c;
break a;
case "function":
d = !0;
break a;
default:
d = !1
}
d ? this.v(c) : this.m(c)
}
};
b.prototype.v = function(c) {
var d = void 0;
try {
d = c.then
} catch (g) {
this.l(g);
return
}
"function" == typeof d ? this.D(d, c) : this.m(c)
};
b.prototype.l = function(c) {
this.u(2, c)
};
b.prototype.m = function(c) {
this.u(1, c)
};
b.prototype.u = function(c, d) {
if (0 != this.h) throw Error("Cannot settle(" + c + ", " + d + "): Promise already settled in state" + this.h);
this.h = c;
this.i = d;
2 === this.h && this.B();
this.H()
};
b.prototype.B = function() {
var c = this;
h(function() {
if (c.I()) {
var d = u.console;
"undefined" !== typeof d && d.error(c.i)
}
}, 1)
};
b.prototype.I =
function() {
if (this.o) return !1;
var c = u.CustomEvent,
d = u.Event,
g = u.dispatchEvent;
if ("undefined" === typeof g) return !0;
"function" === typeof c ? c = new c("unhandledrejection", {
cancelable: !0
}) : "function" === typeof d ? c = new d("unhandledrejection", {
cancelable: !0
}) : (c = u.document.createEvent("CustomEvent"), c.initCustomEvent("unhandledrejection", !1, !0, c));
c.promise = this;
c.reason = this.i;
return g(c)
};
b.prototype.H = function() {
if (null != this.g) {
for (var c = 0; c < this.g.length; ++c) l.h(this.g[c]);
this.g = null
}
};
var l = new e;
b.prototype.C =
function(c) {
var d = this.j();
c.s(d.resolve, d.reject)
};
b.prototype.D = function(c, d) {
var g = this.j();
try {
c.call(d, g.resolve, g.reject)
} catch (k) {
g.reject(k)
}
};
b.prototype.then = function(c, d) {
function g(p, r) {
return "function" == typeof p ? function(E) {
try {
k(p(E))
} catch (F) {
m(F)
}
} : r
}
var k, m, G = new b(function(p, r) {
k = p;
m = r
});
this.s(g(c, k), g(d, m));
return G
};
b.prototype.catch = function(c) {
return this.then(void 0, c)
};
b.prototype.s = function(c, d) {
function g() {
switch (k.h) {
case 1:
c(k.i);
break;
case 2:
d(k.i);
break;
default:
throw Error("Unexpected state: " +
k.h);
}
}
var k = this;
null == this.g ? l.h(g) : this.g.push(g);
this.o = !0
};
b.resolve = f;
b.reject = function(c) {
return new b(function(d, g) {
g(c)
})
};
b.race = function(c) {
return new b(function(d, g) {
for (var k = x(c), m = k.next(); !m.done; m = k.next()) f(m.value).s(d, g)
})
};
b.all = function(c) {
var d = x(c),
g = d.next();
return g.done ? f([]) : new b(function(k, m) {
function G(E) {
return function(F) {
p[E] = F;
r--;
0 == r && k(p)
}
}
var p = [],
r = 0;
do p.push(void 0), r++, f(g.value).s(G(p.length - 1), m), g = d.next(); while (!g.done)
})
};
return b
});
var K = "function" == typeof Object.assign ? Object.assign : function(a, b) {
for (var e = 1; e < arguments.length; e++) {
var f = arguments[e];
if (f)
for (var h in f) Object.prototype.hasOwnProperty.call(f, h) && (a[h] = f[h])
}
return a
};
v("Object.assign", function(a) {
return a || K
});
var L = this || self;
var M = {
facingMode: "user",
width: 640,
height: 480
};
function N(a, b) {
this.video = a;
this.i = 0;
this.h = Object.assign(Object.assign({}, M), b)
}
N.prototype.stop = function() {
var a = this,
b, e, f, h;
return J(new I(new B(function(l) {
if (a.g) {
b = a.g.getTracks();
e = x(b);
for (f = e.next(); !f.done; f = e.next()) h = f.value, h.stop();
a.g = void 0
}
l.j = 0
})))
};
N.prototype.start = function() {
var a = this,
b;
return J(new I(new B(function(e) {
navigator.mediaDevices && navigator.mediaDevices.getUserMedia || alert("No navigator.mediaDevices.getUserMedia exists.");
b = a.h;
return e.return(navigator.mediaDevices.getUserMedia({
video: {
facingMode: b.facingMode,
width: b.width,
height: b.height
}
}).then(function(f) {
O(a, f)
}).catch(function(f) {
var h = "Failed to acquire camera feed: " + f;
console.error(h);
alert(h);
throw f;
}))
})))
};
function P(a) {
window.requestAnimationFrame(function() {
Q(a)
})
}
function O(a, b) {
a.g = b;
a.video.srcObject = b;
a.video.onloadedmetadata = function() {
a.video.play();
P(a)
}
}
function Q(a) {
var b = null;
a.video.paused || a.video.currentTime === a.i || (a.i = a.video.currentTime, b = a.h.onFrame());
b ? b.then(function() {
P(a)
}) : P(a)
}
var R = ["Camera"],
S = L;
R[0] in S || "undefined" == typeof S.execScript || S.execScript("var " + R[0]);
for (var T; R.length && (T = R.shift());) R.length || void 0 === N ? S[T] && S[T] !== Object.prototype[T] ? S = S[T] : S = S[T] = {} : S[T] = N;
}).call(this);

File diff suppressed because it is too large Load Diff

@ -1,27 +0,0 @@
//获取手语视频
function getMedia() {
media = infos.media.value
mediaToWords(media)
}
//翻译视频为自然语言
function mediaToWords(media) {
//这里调用hands_recegnation
display(word)
}
//显示自然语言
function display(word) {
var xmlhttp;
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.responseText=="成功") alert("翻译成功!")
else alert("操作失败")
}
}
xmlhttp.open("GET","http://127.0.0.1:8000//",true);
xmlhttp.send();
}

@ -1,27 +0,0 @@
//输入自然语言
function enterWords() {
words = infos.words.value
wordsToMedia(words)
}
//翻译自然语言为动画
function wordsToMedia(words) {
//这里调用word_input
display(media)
}
//显示动画
function display(media) {
var xmlhttp;
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.responseText=="成功") alert("翻译成功!")
else alert("操作失败")
}
}
xmlhttp.open("GET","http://127.0.0.1:8000//",true);
xmlhttp.send();
}
Loading…
Cancel
Save