Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,10 @@ def format_spaces(spaces: Union[List[Dict], str]) -> List[Dict]:
|
|
66 |
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
67 |
return list(executor.map(format_space, valid_spaces))
|
68 |
|
69 |
-
def format_space(space: Dict) -> Dict:
|
|
|
|
|
|
|
70 |
space_id = space.get('id', 'Unknown')
|
71 |
space_name = space_id.split('/')[-1] if '/' in space_id else space_id
|
72 |
|
@@ -90,6 +93,7 @@ def format_space(space: Dict) -> Dict:
|
|
90 |
"hardware": hardware
|
91 |
}
|
92 |
|
|
|
93 |
def get_app_py_content(space_id: str) -> str:
|
94 |
app_py_url = f"https://huggingface.co/spaces/{space_id}/raw/main/app.py"
|
95 |
try:
|
|
|
66 |
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
67 |
return list(executor.map(format_space, valid_spaces))
|
68 |
|
69 |
+
def format_space(space: Union[Dict, str]) -> Dict:
|
70 |
+
if not isinstance(space, dict):
|
71 |
+
return {"error": "Invalid space data"}
|
72 |
+
|
73 |
space_id = space.get('id', 'Unknown')
|
74 |
space_name = space_id.split('/')[-1] if '/' in space_id else space_id
|
75 |
|
|
|
93 |
"hardware": hardware
|
94 |
}
|
95 |
|
96 |
+
|
97 |
def get_app_py_content(space_id: str) -> str:
|
98 |
app_py_url = f"https://huggingface.co/spaces/{space_id}/raw/main/app.py"
|
99 |
try:
|