Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,11 @@ from google.colab import userdata
|
|
| 3 |
import google.generativeai as genai
|
| 4 |
|
| 5 |
# Configure Gemini AI
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
genai.configure(api_key=api_key)
|
| 8 |
|
| 9 |
# Define the model with desired generation configuration
|
|
|
|
| 3 |
import google.generativeai as genai
|
| 4 |
|
| 5 |
# Configure Gemini AI
|
| 6 |
+
try:
|
| 7 |
+
api_key = userdata.get('GEMINI_API') # Fetch the Gemini API key securely
|
| 8 |
+
except NameError:
|
| 9 |
+
api_key = os.environ.get("GEMINI_API") # Get from environment variable if not in Colab
|
| 10 |
+
|
| 11 |
genai.configure(api_key=api_key)
|
| 12 |
|
| 13 |
# Define the model with desired generation configuration
|