Spaces:
Sleeping
Sleeping
Download list_models.py from Presight-AI/app: direct link, hf CLI and curl.
- Browser
- Download file 402 Bytes
-
https://huggingface.co/spaces/Presight-AI/app/resolve/main/list_models.py
- Command line
-
hf download hf://spaces/Presight-AI/app/list_models.py
-
curl -L -o list_models.py https://huggingface.co/spaces/Presight-AI/app/resolve/main/list_models.py
402 Bytes
| import google.generativeai as genai | |
| import os | |
| api_key = os.getenv('GEMINI_API_KEY', 'AIzaSyD72bMoC9tuQyz2QZTWEQqaM2TXk4M_wI0') | |
| genai.configure(api_key=api_key) | |
| print("Listing available models...") | |
| try: | |
| for m in genai.list_models(): | |
| if 'generateContent' in m.supported_generation_methods: | |
| print(f"Name: {m.name}") | |
| except Exception as e: | |
| print(f"Error listing models: {e}") | |