Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -527,7 +527,7 @@ class UltraSupremeOptimizer:
|
|
527 |
|
528 |
if self.device == "cpu":
|
529 |
gc.collect()
|
530 |
-
|
531 |
torch.cuda.empty_cache()
|
532 |
|
533 |
return True
|
@@ -535,8 +535,8 @@ class UltraSupremeOptimizer:
|
|
535 |
except Exception as e:
|
536 |
logger.error(f"Initialization error: {e}")
|
537 |
return False
|
538 |
-
|
539 |
-
def optimize_image(self, image):
|
540 |
if image is None:
|
541 |
return None
|
542 |
|
@@ -564,6 +564,12 @@ def optimize_image(self, image):
|
|
564 |
if image is None:
|
565 |
return "❌ Please upload an image.", "No image provided.", 0, {}
|
566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
start_time = datetime.now()
|
568 |
|
569 |
# ULTRA SUPREME TRIPLE CLIP ANALYSIS
|
|
|
527 |
|
528 |
if self.device == "cpu":
|
529 |
gc.collect()
|
530 |
+
else:
|
531 |
torch.cuda.empty_cache()
|
532 |
|
533 |
return True
|
|
|
535 |
except Exception as e:
|
536 |
logger.error(f"Initialization error: {e}")
|
537 |
return False
|
538 |
+
|
539 |
+
def optimize_image(self, image):
|
540 |
if image is None:
|
541 |
return None
|
542 |
|
|
|
564 |
if image is None:
|
565 |
return "❌ Please upload an image.", "No image provided.", 0, {}
|
566 |
|
567 |
+
self.usage_count += 1
|
568 |
+
|
569 |
+
image = self.optimize_image(image)
|
570 |
+
if image is None:
|
571 |
+
return "❌ Image processing failed.", "Invalid image format.", 0, {}
|
572 |
+
|
573 |
start_time = datetime.now()
|
574 |
|
575 |
# ULTRA SUPREME TRIPLE CLIP ANALYSIS
|