Spaces:
Runtime error
Runtime error
better retry for models with noe image
Browse files
app.py
CHANGED
|
@@ -194,8 +194,16 @@ async def sync_data():
|
|
| 194 |
with database.get_db() as db:
|
| 195 |
cursor = db.cursor()
|
| 196 |
cursor.execute(
|
| 197 |
-
"SELECT * from models
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
for model in tqdm(models_no_images):
|
| 200 |
model_id = model['id']
|
| 201 |
model_data = json.loads(model['data'])
|
|
|
|
| 194 |
with database.get_db() as db:
|
| 195 |
cursor = db.cursor()
|
| 196 |
cursor.execute(
|
| 197 |
+
"SELECT * from models")
|
| 198 |
+
all_models = list(cursor.fetchall())
|
| 199 |
+
models_no_images = []
|
| 200 |
+
for model in all_models:
|
| 201 |
+
model_data = json.loads(model['data'])
|
| 202 |
+
images = model_data['images']
|
| 203 |
+
filtered_images = [x for x in images if x is not None]
|
| 204 |
+
if len(filtered_images) == 0:
|
| 205 |
+
models_no_images.append(model)
|
| 206 |
+
|
| 207 |
for model in tqdm(models_no_images):
|
| 208 |
model_id = model['id']
|
| 209 |
model_data = json.loads(model['data'])
|