Update app.py
Browse files
app.py
CHANGED
|
@@ -22,4 +22,24 @@ PINECONE_API_KEY = userdata.get("PINECONE_API_KEY") # Use the key you set in th
|
|
| 22 |
PINECONE_ENVIRONMENT = "us-east-1" # Use the environment you set in the secrets
|
| 23 |
|
| 24 |
# Initialize Pinecone with the API key
|
| 25 |
-
pc = Pinecone(api_key=PINECONE_API_KEY)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
PINECONE_ENVIRONMENT = "us-east-1" # Use the environment you set in the secrets
|
| 23 |
|
| 24 |
# Initialize Pinecone with the API key
|
| 25 |
+
pc = Pinecone(api_key=PINECONE_API_KEY)
|
| 26 |
+
|
| 27 |
+
# Ruta del archivo CSV
|
| 28 |
+
file_path = '/content/dataset.csv'
|
| 29 |
+
|
| 30 |
+
# Cargar el dataset y establecerlo como variable global
|
| 31 |
+
try:
|
| 32 |
+
df = pd.read_csv(file_path)
|
| 33 |
+
DATASET = Dataset.from_pandas(df)
|
| 34 |
+
print(f"Dataset '{file_path}' loaded successfully.\n")
|
| 35 |
+
print(DATASET)
|
| 36 |
+
except Exception as e:
|
| 37 |
+
DATASET = None
|
| 38 |
+
print(f"Error loading dataset: {e}")
|
| 39 |
+
|
| 40 |
+
# Funci贸n para imprimir la informaci贸n del dataset actual
|
| 41 |
+
def print_dataset_info():
|
| 42 |
+
print(f"Current dataset: {DATASET}" if DATASET else "No dataset loaded.")
|
| 43 |
+
|
| 44 |
+
# Guardar la variable global para uso en otras celdas
|
| 45 |
+
get_ipython().run_cell_magic('capture', '', '%store DATASET')
|