Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| def greet(name): | |
| return "Hello " + name + "!!" | |
| def produce_art(prompt): | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| model_id = "atsyplikhin/rita_sd_model" | |
| if torch.cuda.is_available(): | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda") | |
| else: | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32) | |
| bs = 1 | |
| images = pipe([prompt]*bs, num_inference_steps=50, guidance_scale=7.5) | |
| # [images.images[i].save(f"rita-stalin-kefir{i+j*bs}.png") for i in range(bs)] | |
| return images.images[0] | |
| prompt = "RitaT style collage of Stalin with Kefir in outer space, fine details trending on arthouse" | |
| iface = gr.Interface(fn=produce_art, | |
| inputs=gr.Textbox(value=prompt), | |
| outputs=gr.Image(shape=(512, 512)) | |
| ) | |
| iface.launch() |