Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,13 +23,13 @@ def text_to_speech(text, output_path="output.mp3"):
|
|
| 23 |
tts.save(output_path)
|
| 24 |
return output_path
|
| 25 |
|
| 26 |
-
# Function to generate images from a text prompt using Stable Diffusion
|
| 27 |
def generate_images_from_prompt(prompt, num_images=5):
|
| 28 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 29 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 30 |
images = []
|
| 31 |
for i in range(num_images):
|
| 32 |
-
image = pipe(prompt)
|
| 33 |
image_path = f"image_{i}.png"
|
| 34 |
image.save(image_path)
|
| 35 |
images.append(image_path)
|
|
|
|
| 23 |
tts.save(output_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=5):
|
| 28 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 29 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 30 |
images = []
|
| 31 |
for i in range(num_images):
|
| 32 |
+
image = pipe(prompt, num_inference_steps=50)["sample"][0]
|
| 33 |
image_path = f"image_{i}.png"
|
| 34 |
image.save(image_path)
|
| 35 |
images.append(image_path)
|