Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -154,6 +154,8 @@ class PipelineManager:
|
|
154 |
return True, random.uniform(0.6, 0.8)
|
155 |
|
156 |
return False, random.uniform(0.1, 0.3)
|
|
|
|
|
157 |
"""Load models with enhanced error handling and memory optimization"""
|
158 |
if self.model_loaded:
|
159 |
return True
|
@@ -713,33 +715,4 @@ def create_interface():
|
|
713 |
|
714 |
img_generate_btn.click(
|
715 |
fn=generate_img2img,
|
716 |
-
inputs=[img_input,
|
717 |
-
img_strength, img_seed, img_quality],
|
718 |
-
outputs=[img_output_image, img_download_file, img_info],
|
719 |
-
show_progress=True
|
720 |
-
)
|
721 |
-
|
722 |
-
# Example prompt buttons
|
723 |
-
txt_example_btn.click(fn=get_random_prompt, outputs=[txt_prompt])
|
724 |
-
img_example_btn.click(fn=get_random_prompt, outputs=[img_prompt])
|
725 |
-
|
726 |
-
# Clear buttons
|
727 |
-
txt_clear_btn.click(lambda: "", outputs=[txt_prompt])
|
728 |
-
img_clear_btn.click(lambda: "", outputs=[img_prompt])
|
729 |
-
|
730 |
-
return demo
|
731 |
-
|
732 |
-
# Initialize and launch
|
733 |
-
if __name__ == "__main__":
|
734 |
-
logger.info(f"🚀 Initializing CyberRealistic Pony Generator on {DEVICE}")
|
735 |
-
logger.info(f"📱 PyTorch version: {torch.__version__}")
|
736 |
-
logger.info(f"🛡️ NSFW Content Filter: Enabled")
|
737 |
-
|
738 |
-
demo = create_interface()
|
739 |
-
demo.queue(max_size=20) # Enable queuing for better UX
|
740 |
-
demo.launch(
|
741 |
-
server_name="0.0.0.0",
|
742 |
-
server_port=7860,
|
743 |
-
show_error=True,
|
744 |
-
share=False # Set to True if you want a public link
|
745 |
-
)
|
|
|
154 |
return True, random.uniform(0.6, 0.8)
|
155 |
|
156 |
return False, random.uniform(0.1, 0.3)
|
157 |
+
|
158 |
+
def load_models(self) -> bool:
|
159 |
"""Load models with enhanced error handling and memory optimization"""
|
160 |
if self.model_loaded:
|
161 |
return True
|
|
|
715 |
|
716 |
img_generate_btn.click(
|
717 |
fn=generate_img2img,
|
718 |
+
inputs=[img_input,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|