Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
import gemini_gradio
|
3 |
-
import genai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# Configuraci贸n del modelo Gemini
|
6 |
generation_config = {
|
@@ -11,8 +26,6 @@ generation_config = {
|
|
11 |
"response_mime_type": "text/plain",
|
12 |
}
|
13 |
|
14 |
-
GOOGLE_API_KEY = "your_google_api_key_here" # Aseg煤rate de agregar tu API Key
|
15 |
-
|
16 |
# Configuraci贸n del modelo en gemini_gradio
|
17 |
def configure_model():
|
18 |
genai.configure(api_key=GOOGLE_API_KEY) # Configura la API Key
|
|
|
1 |
import gradio as gr
|
2 |
import gemini_gradio
|
3 |
+
import genai
|
4 |
+
import os
|
5 |
+
from dotenv import load_dotenv # Aseg煤rate de instalar dotenv si no lo tienes: pip install python-dotenv
|
6 |
+
|
7 |
+
# Cargar las variables de entorno desde el archivo .env
|
8 |
+
load_dotenv()
|
9 |
+
|
10 |
+
# Verifica la versi贸n de genai
|
11 |
+
print("google-generativeai:", genai.__version__)
|
12 |
+
|
13 |
+
# Obtener la clave de la API de las variables de entorno
|
14 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
15 |
+
|
16 |
+
# Verificar que la clave de la API est茅 configurada
|
17 |
+
if not GOOGLE_API_KEY:
|
18 |
+
raise ValueError("GOOGLE_API_KEY is not set in environment variables.")
|
19 |
|
20 |
# Configuraci贸n del modelo Gemini
|
21 |
generation_config = {
|
|
|
26 |
"response_mime_type": "text/plain",
|
27 |
}
|
28 |
|
|
|
|
|
29 |
# Configuraci贸n del modelo en gemini_gradio
|
30 |
def configure_model():
|
31 |
genai.configure(api_key=GOOGLE_API_KEY) # Configura la API Key
|