Spaces:
Runtime error
Runtime error
Download test_models.py from rexon7777/presightlite: direct link, hf CLI and curl.
- Browser
- Download file 665 Bytes
-
https://huggingface.co/spaces/rexon7777/presightlite/resolve/main/test_models.py
- Command line
-
hf download hf://spaces/rexon7777/presightlite/test_models.py
-
curl -L -o test_models.py https://huggingface.co/spaces/rexon7777/presightlite/resolve/main/test_models.py
665 Bytes
| import google.generativeai as genai | |
| import os | |
| api_key = os.getenv('GEMINI_API_KEY', 'AIzaSyD72bMoC9tuQyz2QZTWEQqaM2TXk4M_wI0') | |
| genai.configure(api_key=api_key) | |
| models_to_test = [ | |
| "gemini-1.5-flash", | |
| "models/gemini-1.5-flash", | |
| "gemini-1.5-flash-001", | |
| "models/gemini-1.5-flash-001", | |
| "gemini-flash-latest", | |
| "models/gemini-flash-latest" | |
| ] | |
| for model in models_to_test: | |
| print(f"Testing model: {model}") | |
| try: | |
| model_instance = genai.GenerativeModel(model) | |
| response = model_instance.generate_content("Hello") | |
| print(f" Success! Response: {response.text}") | |
| except Exception as e: | |
| print(f" Failed: {e}") | |