Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动概述
对项目进行安全加固和转写性能优化,适用于个人/可信网络部署场景。
安全加固
docker-compose.yml127.0.0.1:8820:80,仅限本机访问,防止意外暴露到外网ghcr.io(原ghcr.nju.edu.cn镜像完整性无法验证)Dockerfileapp,容器内以最小权限运行asr2api/__init__.pyclient_max_size),防止内存耗尽攻击except:为具体异常类型(ValueError,IndexError,ContentTypeError),避免掩盖真实错误*收紧为仅允许localhost/127.0.0.1,可通过CORS_ORIGINS环境变量自定义性能优化
asr2api/__init__.pypredict()改用run_in_executor在线程池中执行,不再阻塞 asyncio 事件循环,提升并发能力测试结果
优化后实测耗时(远端 Gradio 推理时间不可控):