Spaces:
Sleeping
Sleeping
Download list_models.py from GICAX/GastroGuard: direct link, hf CLI and curl.
- Browser
- Download file 477 Bytes
-
https://huggingface.co/spaces/GICAX/GastroGuard/resolve/main/list_models.py
- Command line
-
hf download hf://spaces/GICAX/GastroGuard/list_models.py
-
curl -L -o list_models.py https://huggingface.co/spaces/GICAX/GastroGuard/resolve/main/list_models.py
477 Bytes
| from google import genai | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| api_key = os.getenv("GEMINI_API_KEY") | |
| if not api_key: | |
| print("API Key not found") | |
| else: | |
| client = genai.Client(api_key=api_key) | |
| try: | |
| # Pager object | |
| pager = client.models.list() | |
| print("Available Models:") | |
| for model in pager: | |
| print(f"- {model.name}") | |
| except Exception as e: | |
| print(f"Error listing models: {e}") | |