Update app.py
Browse files
app.py
CHANGED
@@ -28,19 +28,19 @@ def load_pipeline(model_id):
|
|
28 |
NUM_CPU_CORES = psutil.cpu_count(logical=True)
|
29 |
|
30 |
# Cap the number of threads to the available physical cores
|
31 |
-
MAX_THREADS =
|
32 |
|
33 |
# Device and hardware configuration
|
34 |
DEVICE = "cpu"
|
35 |
|
36 |
# Model Options (optimized for CPU and memory constraints)
|
37 |
MODEL_OPTIONS = {
|
38 |
-
"Модель штучного інтелекту середня (
|
39 |
-
"Модель штучного інтелекту мала (
|
40 |
}
|
41 |
|
42 |
# Default to fastest model and lower image size for limited resources
|
43 |
-
DEFAULT_MODEL_ID = MODEL_OPTIONS["Модель штучного інтелекту мала (
|
44 |
DEFAULT_IMAGE_SIZE = 512 # Lower default resolution
|
45 |
|
46 |
# Cache models to avoid reloading
|
@@ -103,8 +103,8 @@ with gr.Blocks() as demo:
|
|
103 |
randomize_seed = gr.Checkbox(label="Випадковий Seed", value=True)
|
104 |
|
105 |
with gr.Row():
|
106 |
-
width = gr.Slider(label="Ширина", minimum=512, maximum=
|
107 |
-
height = gr.Slider(label="Висота", minimum=512, maximum=
|
108 |
with gr.Row():
|
109 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=0, maximum=20, step=0.5, value=7.5)
|
110 |
num_inference_steps = gr.Slider(label="Кроки інференсу", minimum=20, maximum=50, step=10, value=20)
|
|
|
28 |
NUM_CPU_CORES = psutil.cpu_count(logical=True)
|
29 |
|
30 |
# Cap the number of threads to the available physical cores
|
31 |
+
MAX_THREADS = max(8, NUM_CPU_CORES)
|
32 |
|
33 |
# Device and hardware configuration
|
34 |
DEVICE = "cpu"
|
35 |
|
36 |
# Model Options (optimized for CPU and memory constraints)
|
37 |
MODEL_OPTIONS = {
|
38 |
+
"Модель штучного інтелекту середня (Більше часу на виконання-краща якість)": "CompVis/stable-diffusion-v1-4",
|
39 |
+
"Модель штучного інтелекту мала (Швидше-середня якість)": "hf-internal-testing/tiny-stable-diffusion-pipe",
|
40 |
}
|
41 |
|
42 |
# Default to fastest model and lower image size for limited resources
|
43 |
+
DEFAULT_MODEL_ID = MODEL_OPTIONS["Модель штучного інтелекту мала (Швидше-середня якість)"]
|
44 |
DEFAULT_IMAGE_SIZE = 512 # Lower default resolution
|
45 |
|
46 |
# Cache models to avoid reloading
|
|
|
103 |
randomize_seed = gr.Checkbox(label="Випадковий Seed", value=True)
|
104 |
|
105 |
with gr.Row():
|
106 |
+
width = gr.Slider(label="Ширина", minimum=512, maximum=512, step=64, value=DEFAULT_IMAGE_SIZE)
|
107 |
+
height = gr.Slider(label="Висота", minimum=512, maximum=512, step=64, value=DEFAULT_IMAGE_SIZE)
|
108 |
with gr.Row():
|
109 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=0, maximum=20, step=0.5, value=7.5)
|
110 |
num_inference_steps = gr.Slider(label="Кроки інференсу", minimum=20, maximum=50, step=10, value=20)
|