Hjgugugjhuhjggg
commited on
Commit
•
5a21f1e
1
Parent(s):
aea29cb
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
import os
|
2 |
import json
|
3 |
-
import logging
|
4 |
import uuid
|
|
|
5 |
from fastapi import FastAPI, HTTPException
|
6 |
from pydantic import BaseModel
|
7 |
from google.cloud import storage
|
8 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
9 |
import uvicorn
|
10 |
import torch
|
11 |
import requests
|
@@ -28,7 +28,7 @@ try:
|
|
28 |
storage_client = storage.Client.from_service_account_info(credentials_info)
|
29 |
bucket = storage_client.bucket(GCS_BUCKET_NAME)
|
30 |
logger.info(f"Conexión con Google Cloud Storage exitosa. Bucket: {GCS_BUCKET_NAME}")
|
31 |
-
except (json.JSONDecodeError, KeyError, ValueError) as e:
|
32 |
logger.error(f"Error al cargar las credenciales o bucket: {e}")
|
33 |
raise RuntimeError(f"Error al cargar las credenciales o bucket: {e}")
|
34 |
|
|
|
1 |
import os
|
2 |
import json
|
|
|
3 |
import uuid
|
4 |
+
import logging
|
5 |
from fastapi import FastAPI, HTTPException
|
6 |
from pydantic import BaseModel
|
7 |
from google.cloud import storage
|
8 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
9 |
import uvicorn
|
10 |
import torch
|
11 |
import requests
|
|
|
28 |
storage_client = storage.Client.from_service_account_info(credentials_info)
|
29 |
bucket = storage_client.bucket(GCS_BUCKET_NAME)
|
30 |
logger.info(f"Conexión con Google Cloud Storage exitosa. Bucket: {GCS_BUCKET_NAME}")
|
31 |
+
except (exceptions.DefaultCredentialsError, json.JSONDecodeError, KeyError, ValueError) as e:
|
32 |
logger.error(f"Error al cargar las credenciales o bucket: {e}")
|
33 |
raise RuntimeError(f"Error al cargar las credenciales o bucket: {e}")
|
34 |
|