Upload all demos to spaces#2281
Conversation
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2281-all-demos |
|
Given that it takes >15min to update all the spaces, and they're only using the latest pip version of gradio (not building from git) I'm now wondering if it makes more sense to update only when the version changes, or if anything in Also, even with Demos, we still only embed the minority of demos in /demos on the website (tough sentence to parse I know...) So maybe uploading everything isn't the right way to go. Me and @aliabid94 will go through all demos at some point and consolidate them a bit, remove duplicates, etc |
|
I'm not sure if its the sheer number of them, but on a few demos Spaces will error out during the build without any actual error. A factory reboot fixes of the space fixes it. Maybe its a timeout thing |
|
Great points @aliabd. My thoughts:
I definitely agree. In addition, if a specific demo in /demos changes, ideally we would only trigger a rebuild for that demo
Yes, we've definitely had a lot of "demo creep". Let's only upload the demos that are being somewhere on the website, which might help with the next point as well...
Good catch. I think we should let the Spaces team know in case it's some infra thing. We should be careful here because we definitely don't want any of the embedded demos on the homepage to go down, or really any of the embedded demos. Does it make sense to maybe trigger a job 15 min after the demos get refreshed that pings all of the Spaces URLs and confirms that they are up? |
|
@aliabd How come the demos use the latest published version of gradio on pypi as opposed to the latest commit to It's on our roadmap to toggle between latest and stable (#1650) but until we do that everything on the website should be the same version in my opinion. |
|
@abidlabs I will play around with this for a bit and find the right set up but in my opinion:
@freddyaboulton I honestly am not sure why Docs track latest from main and not stable from pip. We should at some point allow a toggle but if we have to choose it should definitely be stable in my opinion, given that that's what the overwhelming majority of users will build with. Let's move this discussion to slack but great point on avoiding discrepancies. |
|
where did you move this discussion to slack? (I think this is a fine place for this discussion). |
|
Yeah good point @aliabid94, but if the entire website tracks stable how do we make small changes unrelated to the library? Do we have to upgrade pip in that case? I guess looking backwards we don't make that many changes anymore because things have stabilized a bit. So I'm okay with that. |
| @@ -67,10 +64,11 @@ def upload_demo_to_space( | |||
| ) | |||
There was a problem hiding this comment.
Nit: you don't have to rename run.py to app.py and could instead change app_file to run.py
There was a problem hiding this comment.
thanks @abidlabs, I set the app_file to run.py now. I also updated all the spaces to remove the app.py file and reuploaded with run.py
| @@ -1,20 +1,48 @@ | |||
| <h1 id="upcoming-release">Upcoming Release</h1> | |||
There was a problem hiding this comment.
This file could be git-ignored
There was a problem hiding this comment.
Properly git ignored it, thanks!
|
There is the possibility of a race condition here - the website restarts on a new version.txt change and launches spaces with this new version, but the new version isn't on pypi yet. |
|
Very good catch @aliabid94 Just added What do you think? |
| git pull > /tmp/git_changes.txt | ||
|
|
||
| if grep -q "Already up to date." /tmp/git_changes.txt; then | ||
| if ! grep -q "gradio/version.txt" /tmp/git_changes.txt; then |
There was a problem hiding this comment.
Is this running in a cron job? How often does it run?
I think this logic makes sense. The version.txt should only change when an official release goes out. What happens if we accidentally change version.txt to be a pre-release version, like 3.4.1b10? Does check_version error out?
There was a problem hiding this comment.
Yeah this runs in a cronjob every minute.
Yes, python check_version.py errors out if it can't find the version on pypi. (if the url f"https://pypi.org/project/gradio/{VERSION}/" doesn't return 200)
In that case the web tracker bot will send a notification to slack that looks like this:
Could not find gradio v3.4.1b10 on pypi: https://pypi.org/project/gradio/3.4.1b10/ does not exist
A bit confused though, is this something we do? change version.txt without intending it to upload to pypi?
| demos = [demo for demo in demos if demo != "all_demos" and os.path.isdir(os.path.join(GRADIO_DEMO_DIR, demo)) and os.path.exists(os.path.join(GRADIO_DEMO_DIR, demo, "run.py"))] | ||
|
|
||
| if __name__ == "__main__": | ||
| if AUTH_TOKEN is not None: |
There was a problem hiding this comment.
Nice, can finally build locally again!
|
LGTM |
freddyaboulton
left a comment
There was a problem hiding this comment.
Thanks for the awesome PR @aliabd ! Nothing more to comment except what we discussed at our huddle.
|
Thanks @freddyaboulton @abidlabs for the feedback and catching the prereleases problem. To avoid reflecting prereleases on the docs, I now check to make sure that the version in version.txt is the same as the latest version on pypi (which skips prereleases). So now check_version will exit and halt the build on two scenarios:
What do you think? |
|
👍 👍 |
This PR:
You can play around with the changes on the devserver.
Fixes #2277