Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -548,16 +548,16 @@ def optimize_image(self, image):
|
|
548 |
if image.mode != 'RGB':
|
549 |
image = image.convert('RGB')
|
550 |
|
551 |
-
max_size = 768 if self.device != "cpu" else 512
|
552 |
if image.size[0] > max_size or image.size[1] > max_size:
|
553 |
image.thumbnail((max_size, max_size), Image.Resampling.LANCZOS)
|
554 |
|
555 |
return image
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
if not self.initialize_model():
|
562 |
return "❌ Model initialization failed.", "Please refresh and try again.", 0, {}
|
563 |
|
|
|
548 |
if image.mode != 'RGB':
|
549 |
image = image.convert('RGB')
|
550 |
|
551 |
+
max_size = 768 if self.device != "cpu" else 512
|
552 |
if image.size[0] > max_size or image.size[1] > max_size:
|
553 |
image.thumbnail((max_size, max_size), Image.Resampling.LANCZOS)
|
554 |
|
555 |
return image
|
556 |
|
557 |
+
@spaces.GPU
|
558 |
+
def generate_ultra_supreme_prompt(self, image):
|
559 |
+
try:
|
560 |
+
if not self.is_initialized:
|
561 |
if not self.initialize_model():
|
562 |
return "❌ Model initialization failed.", "Please refresh and try again.", 0, {}
|
563 |
|