Spaces:
Runtime error
Runtime error
File size: 782 Bytes
ceebb70 5440b39 |
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 |
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
def dummy(images, **kwargs): return images, False
def generate_image(prompt):
model_id = "prompthero/openjourney-v4"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.safety_checker = dummy
pipe = pipe.to("cuda")
image = pipe(prompt).images[0]
return image
iface = gr.Interface(
generate_image,
"textbox",
"image",
title="Image Generator",
description="Generate a realistic photo using prompts.",
examples=[["realistic! photoshoot for a new balenciaga lookbook, color film photography, portrait of a beautiful woman wearing a balaclava mask, photo in style of tyler mitchell, 35mm lens"]],
)
iface.launch() |