Spaces:
Runtime error
Runtime error
File size: 1,187 Bytes
8c77367 3dc74fc 9c3795c 3dc74fc 634e30c 8c77367 3dc74fc 8c77367 3dc74fc 154c1fd 3dc74fc 154c1fd |
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 |
from diffusers import StableDiffusionXLPipeline
import gradio as gr
import torch
#from transformers.utils.hub import move_cache
import pkg_resources
#move_cache()
print("------------------------")
package_name = "transformers"
version = pkg_resources.get_distribution(package_name).version
print(f"The version of {package_name} is: {version}")
print("------------------------")
def segMindImage(prompt, negative_prompt):
pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
pipe.to("cuda")
prompt = prompt # Your prompt here
neg_prompt = negative_prompt # Negative prompt here
image = pipe(prompt=prompt, negative_prompt=neg_prompt).images[0]
return image
app = gr.Interface(segMindImage,
inputs = [gr.Text(label="Prompt",placeholder="Write Prompt"),gr.Text(label="Negative Prompt",placeholder="Write Negative Prompt")],
outputs = gr.Image(label="Image"),
css =".gradio-container {background-image: linear-gradient(#7F7FD5, #91EAE4, #A3C9E2)}",
theme = gr.themes.Soft(),
title = "SD Image Diffusion")
app.launch()
|