diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7dc9813..856af33 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,6 +27,7 @@ jobs: - name: Install Gradio runtime test dependencies run: | python -m pip install --disable-pip-version-check \ + --constraint requirements.txt \ pytest==8.3.5 \ "gradio==4.44.1" \ "huggingface_hub<1.0" \ diff --git a/docs/installation.md b/docs/installation.md index d9baf4f..4542f75 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -69,6 +69,14 @@ Confirm `ffmpeg -version` also works; install FFmpeg for your platform if absent ### If Installation Or Startup Fails +**The web UI returns HTTP 500 before showing the upload controls:** if the +traceback ends in `gradio_client.utils.get_type` with `argument of type +'bool' is not iterable`, Gradio 4 is failing to read a file component's +schema. This happens before recognition. In the FunClip environment, run +`python -m pip install -r requirements.txt` from this revision, then +`python -m pip check` and relaunch. There is no need to download the ASR +weights again. Other 500 errors need their own traceback. + **`CERTIFICATE_VERIFY_FAILED` during pip install:** fix the HTTPS trust failure first. It means the package download did not complete, so a later `No module named 'funasr'` is not evidence that requirements omitted the package. Check the failing hostname, system clock, proxy and configured package indexes. Use certificates supplied by your OS/Python distribution or an approved corporate CA; never disable certificate verification or make arbitrary hosts trusted to get an install through. Pip supports an approved CA bundle through `--cert`/`PIP_CERT`; see its [certificate documentation](https://pip.pypa.io/en/stable/topics/https-certificates/). **The package was installed, but this Python cannot find it:** compare the interpreter and pip paths before reinstalling anything: @@ -144,6 +152,13 @@ Python 字节码预编译,不跳过依赖或兼容性检查。安装中断后 ### 按报错阶段处理 +**网页还没显示上传控件就返回 HTTP 500:** 如果异常末尾是 +`gradio_client.utils.get_type` 和 `argument of type 'bool' is not iterable`, +是 Gradio 4 无法读取文件组件的字段描述,此时尚未开始识别。在 FunClip +自己的环境中,从此版本的仓库根目录执行 `python -m pip install -r requirements.txt` +和 `python -m pip check`,再重新启动 FunClip。不需要重新下载 ASR 权重; +其他 500 错误请根据各自的异常栈排查。 + **安装时出现 `CERTIFICATE_VERIFY_FAILED`:** 先处理 HTTPS 证书信任问题。下载未完成,后续出现 `No module named 'funasr'` 并不说明依赖清单漏了这个包。检查失败域名、系统时间、代理和 pip 源;使用操作系统/Python 发行版提供的证书,企业代理则使用经管理员认可的 CA。不要通过关闭校验或随意信任主机绕过错误。受信任 CA 的 `--cert`/`PIP_CERT` 配置见 [pip 官方证书说明](https://pip.pypa.io/en/stable/topics/https-certificates/)。 **安装成功却找不到模块:** 运行英文部分的解释器和版本检查命令。确认 `sys.executable`、`python -m pip --version` 指向同一个虚拟环境,再用相同的 `python` 启动。不要把另一个 shell、IDE 或 notebook 的安装结果当成当前环境已经装好。 diff --git a/requirements.txt b/requirements.txt index 25d9fc1..f559b68 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,8 @@ moviepy==1.0.3 pillow numpy==1.26.4 gradio>=4.31.3,<5.0 +# Gradio 4's file schema converter cannot read boolean additionalProperties. +pydantic>=2,<2.11 starlette<1.0 modelscope torch>=1.13 diff --git a/tests/test_gradio_runtime_compat.py b/tests/test_gradio_runtime_compat.py index 977122f..2dcd344 100644 --- a/tests/test_gradio_runtime_compat.py +++ b/tests/test_gradio_runtime_compat.py @@ -18,12 +18,14 @@ def test_gradio4_excludes_breaking_starlette_releases(): assert "starlette<1.0" in requirements -def test_supported_gradio_stack_renders_index(): +def test_file_upload_and_download_schema_renders_index(): import gradio from starlette.testclient import TestClient with gradio.Blocks() as demo: - gradio.Markdown("FunClip runtime smoke test") + video = gradio.Video() + transcript = gradio.File() + gradio.Button("Recognize").click(lambda _: None, inputs=video, outputs=transcript) app = gradio.routes.App.create_app(demo) response = TestClient(app).get("/")