Update app.py
Browse files
app.py
CHANGED
|
@@ -3,15 +3,11 @@ import spaces
|
|
| 3 |
import torch
|
| 4 |
from diffusers import AuraFlowPipeline
|
| 5 |
|
| 6 |
-
# Initialize the AuraFlow pipeline
|
| 7 |
pipe = AuraFlowPipeline.from_pretrained("purplesmartai/pony-v7-base", torch_dtype=torch.float16)
|
| 8 |
pipe = pipe.to("cuda")
|
| 9 |
|
| 10 |
@spaces.GPU()
|
| 11 |
def generate_image(prompt, negative_prompt, height, width, num_inference_steps, guidance_scale, seed):
|
| 12 |
-
"""
|
| 13 |
-
Function to generate an image using the AuraFlow pipeline.
|
| 14 |
-
"""
|
| 15 |
generator = torch.Generator("cuda").manual_seed(seed)
|
| 16 |
image = pipe(
|
| 17 |
prompt=prompt,
|
|
@@ -24,7 +20,6 @@ def generate_image(prompt, negative_prompt, height, width, num_inference_steps,
|
|
| 24 |
).images[0]
|
| 25 |
return image
|
| 26 |
|
| 27 |
-
# Create the Gradio interface
|
| 28 |
iface = gr.Interface(
|
| 29 |
fn=generate_image,
|
| 30 |
inputs=[
|
|
@@ -36,10 +31,9 @@ iface = gr.Interface(
|
|
| 36 |
gr.Slider(label="Guidance Scale", minimum=1.0, maximum=20.0, step=0.1, value=5.0),
|
| 37 |
gr.Number(label="Seed", value=42)
|
| 38 |
],
|
| 39 |
-
outputs=gr.Image(label="Generated Image"),
|
| 40 |
-
title="
|
| 41 |
description="Generate images from text prompts using the AuraFlow model."
|
| 42 |
)
|
| 43 |
|
| 44 |
-
# Launch the Gradio app
|
| 45 |
iface.launch()
|
|
|
|
| 3 |
import torch
|
| 4 |
from diffusers import AuraFlowPipeline
|
| 5 |
|
|
|
|
| 6 |
pipe = AuraFlowPipeline.from_pretrained("purplesmartai/pony-v7-base", torch_dtype=torch.float16)
|
| 7 |
pipe = pipe.to("cuda")
|
| 8 |
|
| 9 |
@spaces.GPU()
|
| 10 |
def generate_image(prompt, negative_prompt, height, width, num_inference_steps, guidance_scale, seed):
|
|
|
|
|
|
|
|
|
|
| 11 |
generator = torch.Generator("cuda").manual_seed(seed)
|
| 12 |
image = pipe(
|
| 13 |
prompt=prompt,
|
|
|
|
| 20 |
).images[0]
|
| 21 |
return image
|
| 22 |
|
|
|
|
| 23 |
iface = gr.Interface(
|
| 24 |
fn=generate_image,
|
| 25 |
inputs=[
|
|
|
|
| 31 |
gr.Slider(label="Guidance Scale", minimum=1.0, maximum=20.0, step=0.1, value=5.0),
|
| 32 |
gr.Number(label="Seed", value=42)
|
| 33 |
],
|
| 34 |
+
outputs=gr.Image(label="Generated Image", format="png"),
|
| 35 |
+
title="purplesmartai/pony-v7-base",
|
| 36 |
description="Generate images from text prompts using the AuraFlow model."
|
| 37 |
)
|
| 38 |
|
|
|
|
| 39 |
iface.launch()
|