Spaces:
Runtime error
Runtime error
File size: 1,301 Bytes
426983d 7de92e2 426983d 7de92e2 426983d 7de92e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
from diffusers import DiffusionPipeline
import gradio as gr
import torch
# Check device availability
device = "cuda" if torch.cuda.is_available() else "cpu"
# Load DiffusionPipeline model
pipeline = DiffusionPipeline.from_pretrained("anusha-bhambore/live-eventful")
pipeline = pipeline.to(device)
def generate_image_interface(prompt, negative_prompt, gender, age, num_inference_steps=50, weight=640):
params = {
'prompt': prompt,
'num_inference_steps': num_inference_steps,
'num_images_per_prompt': 2,
'height': int(1.2 * weight),
'weight': weight,
'negative_prompt': negative_prompt,
'gender': gender,
'age': age
}
img = pipeline(**params).images
return img[0], img[1]
description = "Experience the magic of personalized birthday event design with our innovative web app! Simply input your preferences and prompts, and watch as your creative ideas transform into stunning, one-of-a-kind birthday event images."
# Deploy the interface with shareable link
demo = gr.Interface(
fn=generate_image_interface,
title="Birthday Events",
inputs=["text", "text", "text", "text", gr.Slider(1, 100), gr.Slider(512, 640)],
outputs=["image", "image"],
description=description
)
demo.launch(share=True)
|