patrickacraig commited on
Commit
a24c8fd
·
1 Parent(s): 709e431

adding action

Browse files
Files changed (2) hide show
  1. .github/workflows/main.yaml +19 -0
  2. app.py +6 -1
.github/workflows/main.yaml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face Space
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ jobs:
7
+ sync-to-hub:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ with:
12
+ fetch-depth: 0
13
+ lfs: true
14
+ - name: Push to Hugging Face Space
15
+ env:
16
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
17
+ run: |
18
+ git remote add space https://huggingface.co/spaces/patrickacraig/docs-scraper
19
+ git push space main
app.py CHANGED
@@ -7,10 +7,14 @@ from urllib.parse import urlparse
7
 
8
  load_dotenv()
9
 
10
- base_url = os.getenv('BASE_URL')
11
  api_key = os.getenv('FIRECRAWL_API_KEY')
12
  limit_rate = os.getenv('LIMIT_RATE', 'False').lower() == 'true'
13
 
 
 
 
 
14
  # Get Firecrawl App instance
15
  def get_firecrawl_app(api_key):
16
  return FirecrawlApp(api_key=api_key)
@@ -33,6 +37,7 @@ async def async_scrape_url(app, url):
33
  def map_website(app, url):
34
  try:
35
  map_status = app.map_url(url)
 
36
  if isinstance(map_status, list):
37
  return map_status
38
  else:
 
7
 
8
  load_dotenv()
9
 
10
+ base_url = os.getenv('TARGET_URL')
11
  api_key = os.getenv('FIRECRAWL_API_KEY')
12
  limit_rate = os.getenv('LIMIT_RATE', 'False').lower() == 'true'
13
 
14
+ print(f"base_url: {base_url}")
15
+ print(f"api_key: {api_key}")
16
+ print(f"limit_rate: {limit_rate}")
17
+
18
  # Get Firecrawl App instance
19
  def get_firecrawl_app(api_key):
20
  return FirecrawlApp(api_key=api_key)
 
37
  def map_website(app, url):
38
  try:
39
  map_status = app.map_url(url)
40
+ print(f"Map status for {url}: {map_status}")
41
  if isinstance(map_status, list):
42
  return map_status
43
  else: