Hjgugugjhuhjggg commited on
Commit
cb66b7a
verified
1 Parent(s): 660391a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -7,7 +7,7 @@ import boto3
7
  import logging
8
  from huggingface_hub import hf_hub_download
9
 
10
- # Configuraciones de AWS y Hugging Face
11
  AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID")
12
  AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY")
13
  AWS_REGION = os.getenv("AWS_REGION")
@@ -49,11 +49,13 @@ class S3DirectStream:
49
 
50
  # Verificar si la carpeta y los archivos ya existen en S3
51
  if not await self.file_exists_in_s3(f"{model_name}/config.json"):
 
52
  self.create_folder_if_not_exists(model_name)
53
  with open(config_file, "rb") as file:
54
  self.s3_client.put_object(Bucket=self.bucket_name, Key=f"{model_name}/config.json", Body=file)
55
 
56
  if not await self.file_exists_in_s3(f"{model_name}/tokenizer.json"):
 
57
  self.create_folder_if_not_exists(model_name)
58
  with open(tokenizer_file, "rb") as file:
59
  self.s3_client.put_object(Bucket=self.bucket_name, Key=f"{model_name}/tokenizer.json", Body=file)
 
7
  import logging
8
  from huggingface_hub import hf_hub_download
9
 
10
+ # Configuraci贸n de AWS y Hugging Face
11
  AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID")
12
  AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY")
13
  AWS_REGION = os.getenv("AWS_REGION")
 
49
 
50
  # Verificar si la carpeta y los archivos ya existen en S3
51
  if not await self.file_exists_in_s3(f"{model_name}/config.json"):
52
+ logging.info(f"El archivo config.json no existe en S3. Subiendo desde Hugging Face...")
53
  self.create_folder_if_not_exists(model_name)
54
  with open(config_file, "rb") as file:
55
  self.s3_client.put_object(Bucket=self.bucket_name, Key=f"{model_name}/config.json", Body=file)
56
 
57
  if not await self.file_exists_in_s3(f"{model_name}/tokenizer.json"):
58
+ logging.info(f"El archivo tokenizer.json no existe en S3. Subiendo desde Hugging Face...")
59
  self.create_folder_if_not_exists(model_name)
60
  with open(tokenizer_file, "rb") as file:
61
  self.s3_client.put_object(Bucket=self.bucket_name, Key=f"{model_name}/tokenizer.json", Body=file)