Spaces:
Sleeping
Sleeping
| import google.generativeai as genai | |
| import os | |
| # Prefer environment variable, fallback to hardcoded key | |
| api_key = os.getenv("GEMINI_API_KEY", "AIzaSyC-mxxBvsAvP9XzRcI04dBfVoGFL8wCv2I") | |
| if not api_key: | |
| raise ValueError("β Missing GEMINI_API_KEY. Please set it as environment variable or hardcode it.") | |
| # β Configure Gemini | |
| genai.configure(api_key=api_key) | |
| # Example: Generate text | |
| model = genai.GenerativeModel("gemini-1.5-flash") | |
| response = model.generate_content("Rewrite this paragraph to sound more persuasive and concise.") | |
| print(response.text) | |