Spaces:
Runtime error
Runtime error
| """ | |
| Configuration for API keys and model setup. | |
| """ | |
| import os | |
| import google.generativeai as genai | |
| def setup_api(): | |
| """Setup and configure the Gemini API""" | |
| # Retrieve API keys from environment variables | |
| userdata = { | |
| "GEMINI_API_KEY": os.getenv("GEMINI_API_KEY"), | |
| } | |
| api_key = userdata.get("GEMINI_API_KEY") | |
| if not api_key: | |
| raise ValueError("API key not found. Make sure to set it in environment variables.") | |
| #os.environ["GEMINI_API_KEY"] = api_key | |
| genai.configure(api_key=api_key) | |
| return genai.GenerativeModel("gemini-2.0-flash-exp") | |