File size: 630 Bytes
0c34bb8 80ce022 0c34bb8 718e8ae 0c34bb8 5eb6f7e 0c34bb8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
import threading
import numpy as np # Import NumPy for memory-efficient data structures
import gc # Import garbage collector for explicit memory management
# Increase thread stack size
threading.stack_size(2**33)
# Load the model
model = gr.load("models/enhanceaiteam/Flux-uncensored")
# Preload large datasets or pre-trained weights (if applicable)
# ...
# Launch the model in a thread
thread = threading.Thread(target=model.launch)
# Start the thread
thread.start()
# Explicitly trigger garbage collection to free up memory
gc.collect()
# Continue with other tasks or image generation code
# ... |