broadfield-dev commited on
Commit
bc5f07d
·
verified ·
1 Parent(s): 287b4ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,5 +1,5 @@
1
  from flask import Flask, render_template, request, jsonify, send_file
2
- from huggingface_hub import HfApi, HfApiError
3
  import requests
4
  import base64
5
  import markdown
@@ -116,9 +116,9 @@ def get_hf_files(repo, name):
116
  print(f"Processed files: {processed_files}")
117
  return processed_files
118
 
119
- except HfApiError as e:
120
  print(f"Hugging Face API error for {repo}/{name}: {str(e)}")
121
- return []
122
  except Exception as e:
123
  print(f"Error processing Hugging Face files for {repo}/{name}: {str(e)}")
124
  return []
@@ -133,8 +133,8 @@ def get_repo_contents(url):
133
  try:
134
  api = HfApi()
135
  api.list_repo_files(repo_id=f'{owner}/{repo}', repo_type="space") # Pre-check
136
- except HfApiError as e:
137
- raise Exception(f"Hugging Face Space not found or inaccessible: {str(e)}")
138
 
139
  files = get_hf_files(owner, repo)
140
  if not files: # Empty list is valid, but check for errors
 
1
  from flask import Flask, render_template, request, jsonify, send_file
2
+ from huggingface_hub import HfApi
3
  import requests
4
  import base64
5
  import markdown
 
116
  print(f"Processed files: {processed_files}")
117
  return processed_files
118
 
119
+ '''except HfApiError as e:
120
  print(f"Hugging Face API error for {repo}/{name}: {str(e)}")
121
+ return []'''
122
  except Exception as e:
123
  print(f"Error processing Hugging Face files for {repo}/{name}: {str(e)}")
124
  return []
 
133
  try:
134
  api = HfApi()
135
  api.list_repo_files(repo_id=f'{owner}/{repo}', repo_type="space") # Pre-check
136
+ '''except HfApiError as e:
137
+ raise Exception(f"Hugging Face Space not found or inaccessible: {str(e)}")'''
138
 
139
  files = get_hf_files(owner, repo)
140
  if not files: # Empty list is valid, but check for errors