Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,17 @@ import torch
|
|
4 |
|
5 |
# Load the quantized model from Hugging Face
|
6 |
model_id = "Intel/sd-1.5-square-quantized"
|
7 |
-
pipe = OVStableDiffusionPipeline.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Define the inference function
|
10 |
def generate_image(prompt):
|
11 |
# Generate the image
|
12 |
-
image = pipe(prompt, num_inference_steps=
|
13 |
return image
|
14 |
|
15 |
# Create the Gradio interface
|
|
|
4 |
|
5 |
# Load the quantized model from Hugging Face
|
6 |
model_id = "Intel/sd-1.5-square-quantized"
|
7 |
+
pipe = OVStableDiffusionPipeline.from_pretrained(
|
8 |
+
model_id,
|
9 |
+
export=False,
|
10 |
+
trust_remote_code=True, # Allow custom code if needed
|
11 |
+
ov_config={"CACHE_DIR": ""} # Optional: disable caching if it’s causing issues
|
12 |
+
)
|
13 |
|
14 |
# Define the inference function
|
15 |
def generate_image(prompt):
|
16 |
# Generate the image
|
17 |
+
image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]
|
18 |
return image
|
19 |
|
20 |
# Create the Gradio interface
|