Spaces:
Sleeping
Sleeping
Download test_api.py from Gini-Eddie/ATS-Intelligence-System: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/spaces/Gini-Eddie/ATS-Intelligence-System/resolve/main/test_api.py
- Command line
-
hf download hf://spaces/Gini-Eddie/ATS-Intelligence-System/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/Gini-Eddie/ATS-Intelligence-System/resolve/main/test_api.py
644 Bytes
| import os | |
| from google import genai | |
| from dotenv import load_dotenv | |
| # Load the API key from your .env file | |
| load_dotenv() | |
| print("Attempting to connect to Gemini API...") | |
| try: | |
| client = genai.Client(api_key=os.getenv("GEMINI_API_KEY")) | |
| # A simple, tiny request | |
| response = client.models.generate_content( | |
| model='gemini-2.5-flash', | |
| contents='Reply with the exact words: "Connection Successful!"' | |
| ) | |
| print("\n✅ SUCCESS! The API is reachable.") | |
| print(f"Gemini says: {response.text}") | |
| except Exception as e: | |
| print("\n❌ FAILED. The network block is still active.") | |
| print(f"Error Details: {str(e)}") |