Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,17 +9,21 @@ model_id = "None1145/noobai-XL-Vpred-0.65s-openvino"
|
|
9 |
pipe = OVStableDiffusionXLPipeline.from_pretrained(model_id)
|
10 |
|
11 |
# Initialize previous dimensions
|
12 |
-
prev_height =
|
13 |
-
prev_width =
|
|
|
|
|
14 |
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
MAX_IMAGE_SIZE = 2048
|
17 |
|
18 |
def reload_model(new_model_id):
|
19 |
-
global pipe, model_id
|
20 |
model_id = new_model_id
|
21 |
try:
|
22 |
pipe = OVStableDiffusionXLPipeline.from_pretrained(model_id)
|
|
|
|
|
23 |
return f"Model successfully loaded: {model_id}"
|
24 |
except Exception as e:
|
25 |
return f"Failed to load model: {str(e)}"
|
@@ -141,7 +145,7 @@ with gr.Blocks() as img:
|
|
141 |
|
142 |
gr.Markdown("### Model Reload")
|
143 |
with gr.Row():
|
144 |
-
new_model_id = gr.Text(label="New Model ID", placeholder="Enter
|
145 |
reload_button = gr.Button("Reload Model", variant="primary")
|
146 |
reload_status = gr.Text(label="Status", interactive=False)
|
147 |
|
|
|
9 |
pipe = OVStableDiffusionXLPipeline.from_pretrained(model_id)
|
10 |
|
11 |
# Initialize previous dimensions
|
12 |
+
prev_height = 1216
|
13 |
+
prev_width = 832
|
14 |
+
pipe.reshape(batch_size=1, height=prev_height, width=prev_width, num_images_per_prompt=1)
|
15 |
+
pipe.compile()
|
16 |
|
17 |
MAX_SEED = np.iinfo(np.int32).max
|
18 |
MAX_IMAGE_SIZE = 2048
|
19 |
|
20 |
def reload_model(new_model_id):
|
21 |
+
global pipe, model_id, prev_height, prev_width
|
22 |
model_id = new_model_id
|
23 |
try:
|
24 |
pipe = OVStableDiffusionXLPipeline.from_pretrained(model_id)
|
25 |
+
pipe.reshape(batch_size=1, height=prev_height, width=prev_width, num_images_per_prompt=1)
|
26 |
+
pipe.compile()
|
27 |
return f"Model successfully loaded: {model_id}"
|
28 |
except Exception as e:
|
29 |
return f"Failed to load model: {str(e)}"
|
|
|
145 |
|
146 |
gr.Markdown("### Model Reload")
|
147 |
with gr.Row():
|
148 |
+
new_model_id = gr.Text(label="New Model ID", placeholder="Enter model ID", value=model_id)
|
149 |
reload_button = gr.Button("Reload Model", variant="primary")
|
150 |
reload_status = gr.Text(label="Status", interactive=False)
|
151 |
|