ginipick commited on
Commit
72381ba
·
verified ·
1 Parent(s): 718118e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -80,13 +80,18 @@ def format_space(space: Dict) -> Dict:
80
  "thumbnail": thumbnail,
81
  "hardware": hardware
82
  }
83
-
84
  def format_spaces(spaces: Union[List[Dict], str]) -> List[Dict]:
85
  if isinstance(spaces, str):
86
  return [{"error": spaces}]
87
 
 
 
 
88
  with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
89
- return list(executor.map(format_space, spaces))
 
 
90
 
91
  def get_app_py_content(space_id: str) -> str:
92
  app_py_url = f"https://huggingface.co/spaces/{space_id}/raw/main/app.py"
 
80
  "thumbnail": thumbnail,
81
  "hardware": hardware
82
  }
83
+
84
  def format_spaces(spaces: Union[List[Dict], str]) -> List[Dict]:
85
  if isinstance(spaces, str):
86
  return [{"error": spaces}]
87
 
88
+ # Ensure that all items in the list are dictionaries
89
+ valid_spaces = [space for space in spaces if isinstance(space, dict)]
90
+
91
  with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
92
+ return list(executor.map(format_space, valid_spaces))
93
+
94
+
95
 
96
  def get_app_py_content(space_id: str) -> str:
97
  app_py_url = f"https://huggingface.co/spaces/{space_id}/raw/main/app.py"