Spaces:
Sleeping
Sleeping
Hjgugugjhuhjggg
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -119,6 +119,7 @@ class S3DirectStream:
|
|
119 |
for i in range(1, len(folder_keys)):
|
120 |
folder_key = '/'.join(folder_keys[:i]) + '/'
|
121 |
if not await self.file_exists_in_s3(folder_key):
|
|
|
122 |
self.s3_client.put_object(Bucket=self.bucket_name, Key=folder_key, Body='')
|
123 |
|
124 |
except Exception as e:
|
@@ -160,6 +161,9 @@ async def predict(model_request: dict):
|
|
160 |
raise HTTPException(status_code=400, detail="Faltan parámetros en la solicitud.")
|
161 |
|
162 |
streamer = S3DirectStream(S3_BUCKET_NAME)
|
|
|
|
|
|
|
163 |
model = await streamer.load_model_from_s3(model_name)
|
164 |
tokenizer = await streamer.load_tokenizer_from_s3(model_name)
|
165 |
|
|
|
119 |
for i in range(1, len(folder_keys)):
|
120 |
folder_key = '/'.join(folder_keys[:i]) + '/'
|
121 |
if not await self.file_exists_in_s3(folder_key):
|
122 |
+
logger.info(f"Creando carpeta en S3: {folder_key}")
|
123 |
self.s3_client.put_object(Bucket=self.bucket_name, Key=folder_key, Body='')
|
124 |
|
125 |
except Exception as e:
|
|
|
161 |
raise HTTPException(status_code=400, detail="Faltan parámetros en la solicitud.")
|
162 |
|
163 |
streamer = S3DirectStream(S3_BUCKET_NAME)
|
164 |
+
|
165 |
+
await streamer.create_s3_folders(model_name) # Crear las carpetas si no existen
|
166 |
+
|
167 |
model = await streamer.load_model_from_s3(model_name)
|
168 |
tokenizer = await streamer.load_tokenizer_from_s3(model_name)
|
169 |
|