Spaces:
Build error
Build error
Update agent_functions.py
Browse files- agent_functions.py +3 -9
agent_functions.py
CHANGED
|
@@ -1,20 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
# agent_functions.py
|
| 3 |
import pandas as pd
|
| 4 |
from reportlab.lib.pagesizes import letter
|
| 5 |
from reportlab.pdfgen import canvas
|
| 6 |
-
from dotenv import load_dotenv
|
| 7 |
import openai
|
| 8 |
-
import os
|
| 9 |
import tempfile
|
| 10 |
from google.cloud import texttospeech
|
| 11 |
import time
|
| 12 |
|
| 13 |
-
|
| 14 |
-
# Cargar la clave API desde el archivo .env
|
| 15 |
-
load_dotenv()
|
| 16 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "botidinamix-g.json"
|
| 17 |
-
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 18 |
|
| 19 |
# Instancia el cliente de Text-to-Speech
|
| 20 |
client = texttospeech.TextToSpeechClient()
|
|
@@ -45,10 +39,10 @@ class OrdenTool:
|
|
| 45 |
|
| 46 |
def leer_menu_csv(filepath):
|
| 47 |
menu = pd.read_csv(filepath)
|
|
|
|
| 48 |
print("Columnas del men煤 CSV:", menu.columns.tolist()) # Imprimir nombres de columnas para verificaci贸n
|
| 49 |
return menu
|
| 50 |
|
| 51 |
-
|
| 52 |
def generar_pdf_orden(order_details, filepath='orden_compra.pdf'):
|
| 53 |
c = canvas.Canvas(filepath, pagesize=letter)
|
| 54 |
width, height = letter
|
|
|
|
| 1 |
+
import os
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from reportlab.lib.pagesizes import letter
|
| 4 |
from reportlab.pdfgen import canvas
|
|
|
|
| 5 |
import openai
|
|
|
|
| 6 |
import tempfile
|
| 7 |
from google.cloud import texttospeech
|
| 8 |
import time
|
| 9 |
|
| 10 |
+
# Configura la variable de entorno para las credenciales de Google Cloud
|
|
|
|
|
|
|
| 11 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "botidinamix-g.json"
|
|
|
|
| 12 |
|
| 13 |
# Instancia el cliente de Text-to-Speech
|
| 14 |
client = texttospeech.TextToSpeechClient()
|
|
|
|
| 39 |
|
| 40 |
def leer_menu_csv(filepath):
|
| 41 |
menu = pd.read_csv(filepath)
|
| 42 |
+
menu.columns = menu.columns.str.strip() # Eliminar espacios en blanco de los nombres de las columnas
|
| 43 |
print("Columnas del men煤 CSV:", menu.columns.tolist()) # Imprimir nombres de columnas para verificaci贸n
|
| 44 |
return menu
|
| 45 |
|
|
|
|
| 46 |
def generar_pdf_orden(order_details, filepath='orden_compra.pdf'):
|
| 47 |
c = canvas.Canvas(filepath, pagesize=letter)
|
| 48 |
width, height = letter
|