Dropdown for seeing docs as latest or main #2544
Conversation
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2544-all-demos |
… into aliabd/toggle-main-pip
|
|
||
| ## Documentation Changes: | ||
| No changes to highlight. | ||
| * See docs for the latest gradio commit to main as well the latest pip release: |
There was a problem hiding this comment.
Let's move this up to 3.9 section
freddyaboulton
left a comment
There was a problem hiding this comment.
@aliabd Thank you for this useful PR! I reviewed the upload demo and buiild logic and it looks good to me. Left some questions but nothing blocking merge.
| - name: Install requirements | ||
| run: python -m pip install -r website/homepage/requirements.txt | ||
| - name: Install gradio | ||
| run: python -m pip install gradio -U |
There was a problem hiding this comment.
We install from pip here right? And the reason is so that we do not use the local front-end code?
There was a problem hiding this comment.
Not sure what you mean by local front-end code.
We install from pip the latest released version because that's where we want to generate these docs from. Part of the docs comes from gradio as a module and not form the /website dir. For example gradio.generate_documentation().
But on what will show up in /docs/main we install gradio from the repo and not from pip (this happens inside the Dockerfile)
Lmk if this isn't what you mean
| def wait_for_version(version: str): | ||
| for _ in range(10): | ||
| if is_version_up(version): | ||
| latest_gradio_stable = requests.get("https://pypi.org/pypi/gradio/json").json()["info"]["version"] |
There was a problem hiding this comment.
nit: Maybe it's worth putting this in its own helper as I see this logic is in separate files?
| docs_files = os.listdir("src/docs") | ||
| for file in docs_files: | ||
| if file.endswith("_template.html") and file.startswith("v"): | ||
| os.remove(os.path.join("src/docs", file)) |
There was a problem hiding this comment.
We don't need to remove the old version builds right? Might be good to keep them for just-in-case even though there are not displayed on the website?
There was a problem hiding this comment.
yup you're right, might be useful! done
|
LGTM @aliabd! One thing that is happening for me on staging is that the select dropdown to toggle between |
|
I don't see any reason why we've pinned the Gradio versions in these demos. We should be able to unpin and they'll probably work fine |
|
@abidlabs I don't see this specific dropdown issue. Do you see that @freddyaboulton? Screen.Recording.2022-11-04.at.1.35.03.PM.movThat being said though, there is some really bad sluggishness on the website now. For example go https://gradio.app/docs and scroll really fast. you'll see it takes a while for things to render. I guess the page is just really heavy now and we'll have to look into that from the embedding side. No idea why those two demos pinned a gradio version to their requirements, fixed though and should auto update the spaces once this is merged. |
|
@aliabd The dev server behaves the same for me. The dropdown shows both options without lag. Switching versions takes about ~1 second during which the page hangs a bit. We can probably tune that with the other website performance improvements? |
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>



Allows users to see the docs for both main and latest release. Live on staging.
Workflow:
_main) and adds the wheel to their requirements. It also uploads all the demos on spaces to use the latest gradio version if a new one exists./docspage points to a static file that is already generated and saved in the repo namedv{X.X.X}_template.html. The/docs/mainpage is built on every commit. There's a dropdown on each page for readers to switch between them.version.txtis changed in main), a github action opens a PR to add the new versioned docs (newv{X.X.X}_template.htmlfile). The action installs the new version and builds the docs, so there should not be any conflicts, it also uses the versioned gradio.js instead of the built one in/docs/main, so it basically behaves entirely like a snapshot of the docs when the version was released.I tested the github action on a fork of the repo. You can see an example of it working here or failing here because the version was a prerelease/not latest (we don't want to show docs for prereleases)
Closes: #1650