Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def error_str(error, title="Error"):
|
|
28 |
{error}""" if error else ""
|
29 |
|
30 |
@spaces.GPU
|
31 |
-
def inference(prompt, guidance, steps, width=
|
32 |
|
33 |
if torch.cuda.is_available():
|
34 |
generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
@@ -108,27 +108,27 @@ with gr.Blocks(css=css) as demo:
|
|
108 |
prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2,placeholder="[your prompt]")
|
109 |
generate = gr.Button(value="Generate")
|
110 |
|
111 |
-
image_out = gr.Image(height=
|
112 |
error_output = gr.Markdown()
|
113 |
|
114 |
with gr.Column(scale=45):
|
115 |
with gr.Tab("Options"):
|
116 |
with gr.Group():
|
117 |
-
neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image")
|
118 |
|
119 |
with gr.Row():
|
120 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
121 |
steps = gr.Slider(label="Steps", value=24, minimum=4, maximum=50, step=1)
|
122 |
|
123 |
with gr.Row():
|
124 |
-
width = gr.Slider(label="Width", value=
|
125 |
-
height = gr.Slider(label="Height", value=
|
126 |
|
127 |
seed = gr.Slider(0, 2147483647, label='Seed (0 = random)', value=0, step=1)
|
128 |
|
129 |
with gr.Tab("Image to image"):
|
130 |
with gr.Group():
|
131 |
-
image = gr.Image(label="Image", height=
|
132 |
strength = gr.Slider(label="Transformation strength", minimum=0, maximum=1, step=0.01, value=0.5)
|
133 |
|
134 |
inputs = [prompt, guidance, steps, width, height, seed, image, strength, neg_prompt]
|
|
|
28 |
{error}""" if error else ""
|
29 |
|
30 |
@spaces.GPU
|
31 |
+
def inference(prompt, guidance, steps, width=640, height=640, seed=0, img=None, strength=0.5, neg_prompt=""):
|
32 |
|
33 |
if torch.cuda.is_available():
|
34 |
generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
|
|
108 |
prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2,placeholder="[your prompt]")
|
109 |
generate = gr.Button(value="Generate")
|
110 |
|
111 |
+
image_out = gr.Image(height=640)
|
112 |
error_output = gr.Markdown()
|
113 |
|
114 |
with gr.Column(scale=45):
|
115 |
with gr.Tab("Options"):
|
116 |
with gr.Group():
|
117 |
+
neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image", value="deformed, extra limbs, grainy, unfocused, blurry, NSFW, nude, naked")
|
118 |
|
119 |
with gr.Row():
|
120 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
121 |
steps = gr.Slider(label="Steps", value=24, minimum=4, maximum=50, step=1)
|
122 |
|
123 |
with gr.Row():
|
124 |
+
width = gr.Slider(label="Width", value=640, minimum=64, maximum=1024, step=64)
|
125 |
+
height = gr.Slider(label="Height", value=640, minimum=64, maximum=1024, step=64)
|
126 |
|
127 |
seed = gr.Slider(0, 2147483647, label='Seed (0 = random)', value=0, step=1)
|
128 |
|
129 |
with gr.Tab("Image to image"):
|
130 |
with gr.Group():
|
131 |
+
image = gr.Image(label="Image", height=640, type="pil")
|
132 |
strength = gr.Slider(label="Transformation strength", minimum=0, maximum=1, step=0.01, value=0.5)
|
133 |
|
134 |
inputs = [prompt, guidance, steps, width, height, seed, image, strength, neg_prompt]
|