Is it possible to run apps off of non-main branches in a Space?

Loving Spaces (with Gradio) for sharing and evaluating models!

AFAICT, there’s no way to run an app that can be backed by a branch other than main – there’s no documented configuration choice nor is there a branch option on the App tab of the Space. I tried it with the hello world demo here. I haven’t tried with Streamlit yet.

Am I missing something? It’d be great to be able to host/demo different versions of the same model (e.g. throughout training, throughout model development) and use the branch level (or even commit level!) to organize those demos, rather than the repo level.

4 Likes

Hi @charlesfrye,

Thanks for your interest in Spaces.
Running an app on a branch other than the main branch is currently not supported in Spaces.

We’re taking this feedback into account.
(Don’t hesitate to have a look at the changelog)

3 Likes

While not the same as organising with branches, if the aim is just to run a different version you can create a separate Space and push to both from the same local repository.

For example, if the git URL of this secondary Space was https://huggingface.co/spaces/charlesfrye/demo-secondary, you could add it as an extra remote with:

git remote add secondary https://huggingface.co/spaces/charlesfrye/demo-secondary
git push secondary main

After which you can push to origin or push to secondary depending on the changes you want reflected in each Space. Note that you may need to --force or rebase pushes and pulls if the two repos become out of sync.

I understand this approach is at the repo level but hopefully it offers a potential workaround.

2 Likes