Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,21 @@
|
|
1 |
-
from
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
-
def
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
|
|
|
10 |
|
11 |
-
app = gr.Interface(
|
12 |
-
inputs = [gr.
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
title = "
|
17 |
-
theme=gr.themes.Soft())
|
18 |
|
19 |
-
app.launch()
|
|
|
1 |
+
from diffusers import StableDiffusionXLPipeline
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
+
def segMindImage(prompt, negative_prompt):
|
6 |
+
pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
7 |
+
pipe.to("cuda")
|
8 |
+
prompt = prompt # Your prompt here
|
9 |
+
neg_prompt = negative_prompt # Negative prompt here
|
10 |
+
image = pipe(prompt=prompt, negative_prompt=neg_prompt).images[0]
|
11 |
|
12 |
+
return image
|
13 |
|
14 |
+
app = gr.Interface(segMindImage,
|
15 |
+
inputs = [gr.Text(label="Prompt",placeholder="Write Prompt"),gr.Text(label="Negative Prompt",placeholder="Write Negative Prompt")],
|
16 |
+
outputs = gr.Image(label="Image"),
|
17 |
+
css =".gradio-container {background-image: linear-gradient(#7F7FD5, #91EAE4, #A3C9E2)}",
|
18 |
+
theme = gr.themes.Soft(),
|
19 |
+
title = "SD Image Diffusion")
|
|
|
20 |
|
21 |
+
app.launch()
|