Design_Event / app.py
anusha-bhambore's picture
Update app.py
7de92e2 verified
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)