| import requests |
|
|
| |
| def check_space_files(): |
| print("检查Hugging Face Space的文件结构...") |
| url = "https://huggingface.co/api/spaces/chaore/ttsedge/files" |
| |
| try: |
| response = requests.get(url) |
| if response.status_code == 200: |
| files = response.json() |
| print(f"Space中包含 {len(files)} 个文件:") |
| for file in files: |
| print(f" - {file['path']} (大小: {file.get('size', '未知')} 字节)") |
| return True |
| else: |
| print(f"获取文件列表失败: {response.status_code}") |
| print(f"响应内容: {response.text}") |
| return False |
| except Exception as e: |
| print(f"检查文件结构时出错: {e}") |
| return False |
|
|
| |
| def check_space_status(): |
| print("\n检查Space的状态...") |
| url = "https://huggingface.co/api/spaces/chaore/ttsedge" |
| |
| try: |
| response = requests.get(url) |
| if response.status_code == 200: |
| space_info = response.json() |
| print(f"Space名称: {space_info['name']}") |
| print(f"作者: {space_info['author']}") |
| print(f"状态: {space_info['status']}") |
| print(f"最后更新: {space_info['lastModified']}") |
| print(f"可见性: {space_info['private']}") |
| return True |
| else: |
| print(f"获取Space信息失败: {response.status_code}") |
| return False |
| except Exception as e: |
| print(f"检查Space状态时出错: {e}") |
| return False |
|
|
| if __name__ == "__main__": |
| check_space_files() |
| check_space_status() |
|
|