Hjgugugjhuhjggg commited on
Commit
a8df121
1 Parent(s): 8dd39a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -8
app.py CHANGED
@@ -18,14 +18,7 @@ GCS_BUCKET_NAME = os.getenv("GCS_BUCKET_NAME")
18
  GOOGLE_APPLICATION_CREDENTIALS_JSON = os.getenv("GOOGLE_APPLICATION_CREDENTIALS_JSON")
19
  HF_API_TOKEN = os.getenv("HF_API_TOKEN")
20
 
21
- # Validación de nombre del bucket
22
- def validate_bucket_name(bucket_name):
23
- if not re.match(r"^[a-z0-9]([a-z0-9\-\.])*[a-z0-9]$", bucket_name):
24
- raise ValueError(f"Invalid bucket name '{bucket_name}'. Must start and end with a letter or number, and may contain hyphens (-) and dots (.) in between.")
25
- return bucket_name
26
-
27
  try:
28
- GCS_BUCKET_NAME = validate_bucket_name(GCS_BUCKET_NAME)
29
  credentials_info = json.loads(GOOGLE_APPLICATION_CREDENTIALS_JSON)
30
  storage_client = storage.Client.from_service_account_info(credentials_info)
31
  bucket = storage_client.bucket(GCS_BUCKET_NAME)
@@ -57,7 +50,6 @@ class GCSHandler:
57
  return BytesIO(blob.download_as_bytes())
58
 
59
  def download_model_from_huggingface(model_name):
60
- # Usar el model_name directamente sin manipulación
61
  file_patterns = [
62
  "pytorch_model.bin",
63
  "config.json",
 
18
  GOOGLE_APPLICATION_CREDENTIALS_JSON = os.getenv("GOOGLE_APPLICATION_CREDENTIALS_JSON")
19
  HF_API_TOKEN = os.getenv("HF_API_TOKEN")
20
 
 
 
 
 
 
 
21
  try:
 
22
  credentials_info = json.loads(GOOGLE_APPLICATION_CREDENTIALS_JSON)
23
  storage_client = storage.Client.from_service_account_info(credentials_info)
24
  bucket = storage_client.bucket(GCS_BUCKET_NAME)
 
50
  return BytesIO(blob.download_as_bytes())
51
 
52
  def download_model_from_huggingface(model_name):
 
53
  file_patterns = [
54
  "pytorch_model.bin",
55
  "config.json",