Skip to content

Commit f3c9a8d

Browse files
committed
deploy on spaces
gradio deploy add workflows for gradio deploy add workflows add workflows for spaces delete req file correct id, repo name add verbose
1 parent 60ceac3 commit f3c9a8d

File tree

3 files changed

+67
-33
lines changed

3 files changed

+67
-33
lines changed

.github/workflows/update_space.yml

+67-12
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,83 @@
1-
name: Run Python script
1+
name: Deploy to Hugging Face Spaces
22

33
on:
44
push:
55
branches:
66
- main
77

88
jobs:
9-
build:
9+
deploy:
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 30 # Adjust this value as needed
1112

1213
steps:
1314
- name: Checkout
14-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1516

16-
- name: Set up Python
17-
uses: actions/setup-python@v2
17+
- name: Set up Conda
18+
uses: conda-incubator/setup-miniconda@v2
1819
with:
19-
python-version: '3.9'
20+
activate-environment: kg4s
21+
environment-file: environment.yml
22+
auto-activate-base: false
23+
use-mamba: true
2024

21-
- name: Install Gradio
22-
run: python -m pip install gradio
25+
- name: Verify Conda installation
26+
shell: bash -l {0}
27+
run: |
28+
conda info
29+
conda list
2330
24-
- name: Log in to Hugging Face
25-
run: python -c 'import huggingface_hub; huggingface_hub.login(token="${{ secrets.hf_token }}")'
31+
- name: Install huggingface_hub
32+
shell: bash -l {0}
33+
run: |
34+
pip install huggingface_hub
35+
pip list
2636
27-
- name: Deploy to Spaces
28-
run: gradio deploy
37+
- name: Deploy to Hugging Face Spaces
38+
env:
39+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
40+
shell: bash -l {0}
41+
run: |
42+
python - <<EOF
43+
import os
44+
import sys
45+
from huggingface_hub import HfApi
46+
47+
print("Python script started")
48+
print(f"Python version: {sys.version}")
49+
print(f"Current working directory: {os.getcwd()}")
50+
print(f"Contents of current directory: {os.listdir('.')}")
51+
52+
sys.path.append('scripts')
53+
print(f"Updated sys.path: {sys.path}")
54+
print(f"Contents of scripts directory: {os.listdir('scripts')}")
55+
56+
print("Importing demo from run_db_interface")
57+
from run_db_interface import demo
58+
print("Demo imported successfully")
59+
60+
api = HfApi()
61+
print("HfApi initialized")
62+
63+
print("Creating/verifying repository")
64+
api.create_repo(
65+
repo_id="abby101/xurveyor-0",
66+
repo_type="space",
67+
space_sdk="gradio",
68+
token="$HF_TOKEN"
69+
)
70+
print("Repository created or verified")
71+
72+
print("Starting deployment")
73+
demo.deploy(
74+
repo_id="abby101/xurveyor-0",
75+
hf_token="$HF_TOKEN",
76+
)
77+
print("Deployment completed")
78+
EOF
79+
80+
- name: Check Hugging Face Space
81+
run: |
82+
echo "Deployment process completed. Please check your Hugging Face Space at https://huggingface.co/spaces/abby101/xurveyor-0"
83+
echo "If the space is not updated, please check the logs above for any errors."

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
---
2-
title: git_config_-global_credential.helper_store
3-
app_file: scripts/run_db_interface.py
4-
sdk: gradio
5-
sdk_version: 4.40.0
6-
---
71
# Mapping the Data Landscape For Generalizable Scientific Models
82

93
This is a WIP that builds a knowledge base to store structured information extracted from scientific publications, datasets and articles using LLMs.

requirements.txt

-15
This file was deleted.

0 commit comments

Comments
 (0)