Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
# Import necessary libraries
|
2 |
import gradio as gr
|
3 |
-
import
|
|
|
4 |
|
5 |
# Define the function to generate an image from text using the Liberata/illustrious-xl-v1.0 model
|
6 |
def generate_image(prompt, guidance_scale, num_inference_steps):
|
7 |
# Load the model from the specified file
|
8 |
-
model =
|
9 |
-
"
|
|
|
10 |
)
|
11 |
# Generate the image from the text prompt with the specified parameters
|
12 |
image = model(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|
|
|
1 |
# Import necessary libraries
|
2 |
import gradio as gr
|
3 |
+
import diffusers
|
4 |
+
import torch
|
5 |
|
6 |
# Define the function to generate an image from text using the Liberata/illustrious-xl-v1.0 model
|
7 |
def generate_image(prompt, guidance_scale, num_inference_steps):
|
8 |
# Load the model from the specified file
|
9 |
+
model = diffusers.StableDiffusionXLPipeline.from_pretrained(
|
10 |
+
"Liberata/illustrious-xl-v1.0",
|
11 |
+
torch_dtype=torch.float16
|
12 |
)
|
13 |
# Generate the image from the text prompt with the specified parameters
|
14 |
image = model(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|