Spaces:
Runtime error
Runtime error
Kvikontent
commited on
Commit
•
2430f28
1
Parent(s):
a012756
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,11 @@ pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo")
|
|
7 |
@spaces.GPU(duration=250)
|
8 |
def generate_image(prompt):
|
9 |
# Run the diffusion model to generate an image
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
return image
|
12 |
|
13 |
gr_interface = gr.Interface(
|
|
|
7 |
@spaces.GPU(duration=250)
|
8 |
def generate_image(prompt):
|
9 |
# Run the diffusion model to generate an image
|
10 |
+
output = pipe(prompt, num_inference_steps=50, guidance_scale=7.5)
|
11 |
+
image_tensor = output.images[0]
|
12 |
+
image_array = image_tensor.cpu().numpy().transpose(1, 2, 0)
|
13 |
+
image_array = (image_array * 255).astype(np.uint8)
|
14 |
+
image = Image.fromarray(image_array)
|
15 |
return image
|
16 |
|
17 |
gr_interface = gr.Interface(
|