Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,13 +24,13 @@ def text_to_speech(text, output_path="output.mp3"):
|
|
| 24 |
return output_path
|
| 25 |
|
| 26 |
# Function to generate images from a text prompt using Stable Diffusion (CPU)
|
| 27 |
-
def generate_images_from_prompt(prompt, num_images=
|
| 28 |
model_id = "runwayml/stable-diffusion-v1-5"
|
| 29 |
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 30 |
pipe = pipe.to("cpu") # Ensure we are using CPU
|
| 31 |
images = []
|
| 32 |
for i in range(num_images):
|
| 33 |
-
image = pipe(prompt, num_inference_steps=
|
| 34 |
image_path = f"image_{i}.png"
|
| 35 |
image.save(image_path)
|
| 36 |
images.append(image_path)
|
|
|
|
| 24 |
return output_path
|
| 25 |
|
| 26 |
# Function to generate images from a text prompt using Stable Diffusion (CPU)
|
| 27 |
+
def generate_images_from_prompt(prompt, num_images=3, num_inference_steps=20):
|
| 28 |
model_id = "runwayml/stable-diffusion-v1-5"
|
| 29 |
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 30 |
pipe = pipe.to("cpu") # Ensure we are using CPU
|
| 31 |
images = []
|
| 32 |
for i in range(num_images):
|
| 33 |
+
image = pipe(prompt, num_inference_steps=num_inference_steps).images[0]
|
| 34 |
image_path = f"image_{i}.png"
|
| 35 |
image.save(image_path)
|
| 36 |
images.append(image_path)
|