CoolFace
Apppublic

anusha-bhambore/Design_Event

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py38 linesDownload Raw Back to root
1from diffusers import DiffusionPipeline2import gradio as gr3import torch4 5# Check device availability6device = "cuda" if torch.cuda.is_available() else "cpu"7 8# Load DiffusionPipeline model9pipeline = DiffusionPipeline.from_pretrained("anusha-bhambore/live-eventful")10pipeline = pipeline.to(device)11 12def generate_image_interface(prompt, negative_prompt, gender, age, num_inference_steps=50, weight=640):13    params = {14        'prompt': prompt, 15        'num_inference_steps': num_inference_steps, 16        'num_images_per_prompt': 2, 17        'height': int(1.2 * weight),18        'weight': weight, 19        'negative_prompt': negative_prompt,20        'gender': gender, 21        'age': age 22    }23 24    img = pipeline(**params).images25    return img[0], img[1]26 27description = "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."28 29# Deploy the interface with shareable link30demo = gr.Interface(31    fn=generate_image_interface,32    title="Birthday Events",33    inputs=["text", "text", "text", "text", gr.Slider(1, 100), gr.Slider(512, 640)],34    outputs=["image", "image"],35    description=description36)37demo.launch(share=True)38