Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/hf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Sync to Hugging Face Spaces

on:
push:
branches:
- main
workflow_dispatch:

jobs:
sync-to-spaces:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true

- name: Push to HF Spaces
run: chmod +x ./scripts/sync.sh && ./scripts/sync.sh
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USER: ${{ secrets.HF_USER }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ dmypy.json
data/
**/.DS_Store
tmp/

spaces/
13 changes: 13 additions & 0 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sync a clean repository to huggingface spaces
# Set HF_USER and HF_TOKEN in environment variables first

rm -rf spaces && mkdir spaces && cd spaces

cp ../bcgrun_web.py . && cp ../requirements.txt . && cp -r ../bcgunet .

cat ../spaces.yml ../README.md > README.md

git init -b main && git add . && git commit -m "Create Space"
git push https://$HF_USER:$HF_TOKEN@huggingface.co/spaces/bcg-unet/demo.git main -f

cd .. && rm -rf spaces
12 changes: 12 additions & 0 deletions spaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: BCGunet
emoji: 🧠
colorFrom: yellow
colorTo: orange
sdk: gradio
app_file: bcgrun_web.py
python_version: "3.10"
sdk_version: "3.27.0"
pinned: false
---