Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

#
/frontend/build
/frontend/node_modules

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Binary file added backend/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added backend/__pycache__/NET.cpython-38.pyc
Binary file not shown.
Binary file added backend/__pycache__/settings.cpython-38.pyc
Binary file not shown.
44 changes: 44 additions & 0 deletions backend/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from flask import Flask,render_template
from flask_socketio import SocketIO, emit
from settings import NAMESPACE
from NET import *

app = Flask(__name__)

#app.config['CORS_AUTOMATIC_OPTIONS'] = True
#app.config['CORS_SUPPORTS_CREDENTIALS'] = True

socketio = SocketIO(app, cors_allowed_origins="*")

@socketio.on('connect', namespace=NAMESPACE)
def connect():
emit('response', {'data': 'Connected'})
print("Client connected")

@socketio.on('disconnect', namespace=NAMESPACE)
def disconnect():
print('Client disconnected')

@socketio.on('query',namespace = NAMESPACE)
def translate(message):
print(message)
isEnglish = message['isEnglish']
content = message['content']
success = True
try:
res = 英转鱼(content) if isEnglish else 鱼转英(content)
except Exception as e:
res = "Error:"+str(e)
success=False

print('translated:',res)
emit('results', {'content': res,'success':success})

@app.route("/",methods=['GET'])
def hello_world():
return render_template("index.html")

if __name__=="__main__":
print("haha --@DaivdYuan")
socketio.run(app,host='localhost',port=2333,debug=False,log_output=True)
print("MAIN","quitting")
File renamed without changes.
1 change: 1 addition & 0 deletions backend/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NAMESPACE = '/translate'
Binary file added backend/static/favicon.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions backend/static/js/131.2b5ee81d.js

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions backend/static/js/576.2b5ee81d.js

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions backend/static/js/576.2b5ee81d.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/** @license MUI v5.4.2
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
2 changes: 2 additions & 0 deletions backend/static/js/index.2b5ee81d.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions backend/static/js/runtime.2b5ee81d.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions backend/static/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Nerglish Translator",
"name": "Nerglish Translator",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Binary file added backend/static/media/bg.dd38d73e.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions backend/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="static/favicon.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Nerglish Translator" />
<link rel="manifest" href="static/manifest.json" />
<title>Nerglish Translator</title>
<script defer="defer" src="/./static/js/runtime.2b5ee81d.js"></script>
<script defer="defer" src="/./static/js/576.2b5ee81d.js"></script>
<script defer="defer" src="/./static/js/index.2b5ee81d.js"></script>
</head>

<body>
<div id="root"></div>
</body>

</html>
9 changes: 9 additions & 0 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
File renamed without changes.
Loading