# Setup and load your keys import os from g4f import ChatCompletion from google.colab import userdata from pinecone import Pinecone import pandas as pd from datasets import Dataset from sentence_transformers import SentenceTransformer import gradio as gr model_name = "BAAI/bge-m3" # APIs personales #PINECONE_ENVIRONMENT = us-east-1 #PINECONE_API_KEY = 3a3e9022-381d-436e-84cb-ba93464d283e os.environ["PINECONE_ENVIRONMENT"] = "us-east-1" os.environ["PINECONE_API_KEY"] = "3a3e9022-381d-436e-84cb-ba93464d283e" # Retrieve the Pinecone API key from the user PINECONE_API_KEY = userdata.get("PINECONE_API_KEY") # Use the key you set in the secrets PINECONE_ENVIRONMENT = "us-east-1" # Use the environment you set in the secrets # Initialize Pinecone with the API key pc = Pinecone(api_key=PINECONE_API_KEY) # Ruta del archivo CSV file_path = '/content/dataset.csv' # Cargar el dataset y establecerlo como variable global try: df = pd.read_csv(file_path) DATASET = Dataset.from_pandas(df) print(f"Dataset '{file_path}' loaded successfully.\n") print(DATASET) except Exception as e: DATASET = None print(f"Error loading dataset: {e}") # Función para imprimir la información del dataset actual def print_dataset_info(): print(f"Current dataset: {DATASET}" if DATASET else "No dataset loaded.") # Guardar la variable global para uso en otras celdas get_ipython().run_cell_magic('capture', '', '%store DATASET')