fix(webapp): move CSS to launch() for Gradio 6 and disable analytics#1373
fix(webapp): move CSS to launch() for Gradio 6 and disable analytics#1373natoscott wants to merge 1 commit into
Conversation
Gradio 6.0 moved the css parameter from Blocks() to launch(). Disable Gradio telemetry by default -- AIC is a self-hosted tool and the HuggingFace/Gradio analytics requests add startup noise without user benefit. Uses os.environ.setdefault so users can re-enable with GRADIO_ANALYTICS_ENABLED=True if desired. Signed-off-by: Nathan Scott <nathans@redhat.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (6)
🧰 Additional context used📓 Path-based instructions (3)**/*📄 CodeRabbit inference engine (.claude/rules/repo-guide.md)
Files:
⚙️ CodeRabbit configuration file
Files:
**/*.{py,pyi}📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/aiconfigurator/webapp/**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (1)
WalkthroughChangesGradio startup and styling
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
Arsene12358
left a comment
There was a problem hiding this comment.
Verified against the pinned gradio 6.8.0 wheel (pyproject pins gradio==6.8.0): Blocks(css=...) pops the kwarg and emits exactly the quoted UserWarning (blocks.py:1094-1103), and launch() falls back to self._deprecated_css (blocks.py:2591), so the move is behavior-preserving — not just warning-silencing. The analytics claim also checks out: analytics.py:46 reads GRADIO_ANALYTICS_ENABLED with default "True" at Blocks construction time, and setdefault before import gradio preserves the user's ability to opt back in.
One nit, non-blocking: import os could sit at module top with the other imports; it only needs to precede import gradio, which is also inside main().
Coordination note: this PR, #1368, and #1369 all touch the same region of webapp/main.py (the css block / launch call). Suggest merging this one first since it defines where CSS lives going forward.
Overview:
Fixes Gradio 6.0 deprecation warning and suppresses noisy telemetry requests on webapp startup.
Details:
cssparameter fromgr.Blocks()constructor todemo.launch(), as required by Gradio 6.0. Eliminates theUserWarning: The parameters have been moved from the Blocks constructor to the launch() methodwarning on every startup.os.environ.setdefault("GRADIO_ANALYTICS_ENABLED", "False"). AIC is a self-hosted tool and the HuggingFace/Gradio analytics HTTP requests add startup noise without user benefit. Usessetdefaultso users can re-enable withGRADIO_ANALYTICS_ENABLED=Trueif desired.Where should the reviewer start?
src/aiconfigurator/webapp/main.py— single file, ~10 lines changedRelated Issues:
Summary by CodeRabbit