AIdeaText commited on
Commit
47f7094
1 Parent(s): 545e1a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -13,6 +13,7 @@ from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
13
  from azure.cosmos import CosmosClient
14
  from azure.cosmos.exceptions import CosmosHttpResponseError
15
  from pymongo import MongoClient
 
16
 
17
  from dotenv import load_dotenv
18
  load_dotenv()
@@ -50,7 +51,16 @@ if not cosmos_mongodb_connection_string:
50
 
51
  try:
52
  #Crear el cliente de MongoDB
53
- mongo_client = MongoClient(cosmos_mongodb_connection_string)
 
 
 
 
 
 
 
 
 
54
 
55
  #Seleccionar la base de datos
56
  mongo_db = mongo_client['aideatext_db']
 
13
  from azure.cosmos import CosmosClient
14
  from azure.cosmos.exceptions import CosmosHttpResponseError
15
  from pymongo import MongoClient
16
+ from pymongo.server_api import ServerApi
17
 
18
  from dotenv import load_dotenv
19
  load_dotenv()
 
51
 
52
  try:
53
  #Crear el cliente de MongoDB
54
+ mongo_client = MongoClient(
55
+ cosmos_mongodb_connection_string
56
+ serverSelectionTimeoutMS=60000, # 60 segundos
57
+ connectTimeoutMS=30000, # 30 segundos
58
+ socketTimeoutMS=30000, # 30 segundos
59
+ server_api=ServerApi('1')
60
+ )
61
+
62
+ #Forzar una conexión para verificar
63
+ mongo_client.admin.command('ping')
64
 
65
  #Seleccionar la base de datos
66
  mongo_db = mongo_client['aideatext_db']