From 8d226e4b2d32e84a0ee7c269eef750cfd299794b Mon Sep 17 00:00:00 2001 From: Carl Boettiger <cboettig@gmail.com> Date: Thu, 19 Dec 2024 04:27:31 +0000 Subject: [PATCH 1/5] include preview, fix paths :wrench: --- .github/workflows/preview.yml | 20 ++++++++++++++++++++ app/app.py | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..814a42e --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,20 @@ +name: Sync to Hugging Face hub +on: + pull_request: + types: [opened, reopened] + # to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + sync-to-hub: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - name: Push to hub + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + run: git push -f https://cboettig:$HF_TOKEN@huggingface.co/spaces/boettiger-lab/preview-ca-30x30 main + diff --git a/app/app.py b/app/app.py index 27d4ae8..8caef4e 100644 --- a/app/app.py +++ b/app/app.py @@ -150,7 +150,7 @@ class SQLResponse(BaseModel): sql_query: str = Field(description="The SQL query generated by the assistant.") explanation: str = Field(description="A detailed explanation of how the SQL query answers the input question.") -with open('system_prompt.txt', 'r') as file: +with open('app/system_prompt.txt', 'r') as file: template = file.read() from langchain_openai import ChatOpenAI @@ -548,7 +548,7 @@ def summary_table_sql(ca, column, colors, ids): # get df for charts + df_tab for st.divider() -with open('footer.md', 'r') as file: +with open('app/footer.md', 'r') as file: footer = file.read() st.markdown(footer) From 714547df675a0c70d73ba9d949ce4a5acf55eae3 Mon Sep 17 00:00:00 2001 From: Carl Boettiger <cboettig@gmail.com> Date: Thu, 19 Dec 2024 04:42:49 +0000 Subject: [PATCH 2/5] :see_no_evil: --- .github/workflows/preview.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 814a42e..88ce090 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -16,5 +16,8 @@ jobs: - name: Push to hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} - run: git push -f https://cboettig:$HF_TOKEN@huggingface.co/spaces/boettiger-lab/preview-ca-30x30 main + run: | + git remote add preview https://cboettig:$HF_TOKEN@huggingface.co/spaces/boettiger-lab/preview-ca-30x30 + git push --set-upstream preview ${GITHUB_REF}:main + git remote rm preview From 0b83c44f5614a8767d62f30ded8469b24a9e03e3 Mon Sep 17 00:00:00 2001 From: Carl Boettiger <cboettig@gmail.com> Date: Thu, 19 Dec 2024 04:45:08 +0000 Subject: [PATCH 3/5] :see_no_evil: --- .github/workflows/preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 88ce090..44841c9 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,7 +1,7 @@ name: Sync to Hugging Face hub on: pull_request: - types: [opened, reopened] + types: [opened, reopened, edited] # to run this workflow manually from the Actions tab workflow_dispatch: From ea7547ceec698f4ff9bce00c3be8abaf47d8e990 Mon Sep 17 00:00:00 2001 From: Carl Boettiger <cboettig@gmail.com> Date: Thu, 19 Dec 2024 04:47:26 +0000 Subject: [PATCH 4/5] :see_no_evil: --- .github/workflows/preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 44841c9..dfe859c 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,7 +1,6 @@ name: Sync to Hugging Face hub on: pull_request: - types: [opened, reopened, edited] # to run this workflow manually from the Actions tab workflow_dispatch: From 9432653ca0a10370da7662be36b9cda870c279ef Mon Sep 17 00:00:00 2001 From: Carl Boettiger <cboettig@gmail.com> Date: Thu, 19 Dec 2024 04:49:34 +0000 Subject: [PATCH 5/5] :see_no_evil: --- .github/workflows/preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index dfe859c..f263b37 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -17,6 +17,6 @@ jobs: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git remote add preview https://cboettig:$HF_TOKEN@huggingface.co/spaces/boettiger-lab/preview-ca-30x30 - git push --set-upstream preview ${GITHUB_REF}:main + git push --set-upstream preview HEAD:main git remote rm preview