Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,37 +67,54 @@ css = """
|
|
| 67 |
with gr.Blocks(css=css) as demo:
|
| 68 |
with gr.Column(elem_id="col-container"):
|
| 69 |
gr.Markdown(" # Text-to-Image Gradio Template")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
run_button = gr.Button("Run", scale=0, variant="primary")
|
| 81 |
|
| 82 |
result = gr.Image(label="Result", show_label=False)
|
|
|
|
| 83 |
|
| 84 |
with gr.Accordion("Advanced Settings", open=False):
|
| 85 |
-
|
| 86 |
-
label="Negative prompt",
|
| 87 |
-
max_lines=1,
|
| 88 |
-
placeholder="Enter a negative prompt",
|
| 89 |
-
visible=False,
|
| 90 |
-
)
|
| 91 |
-
|
| 92 |
-
seed = gr.Slider(
|
| 93 |
-
label="Seed",
|
| 94 |
-
minimum=0,
|
| 95 |
-
maximum=MAX_SEED,
|
| 96 |
-
step=1,
|
| 97 |
-
value=0,
|
| 98 |
-
)
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
| 101 |
|
| 102 |
with gr.Row():
|
| 103 |
width = gr.Slider(
|
|
@@ -116,22 +133,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 116 |
value=1024, # Replace with defaults that work for your model
|
| 117 |
)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
guidance_scale = gr.Slider(
|
| 121 |
-
label="Guidance scale",
|
| 122 |
-
minimum=0.0,
|
| 123 |
-
maximum=10.0,
|
| 124 |
-
step=0.1,
|
| 125 |
-
value=0.0, # Replace with defaults that work for your model
|
| 126 |
-
)
|
| 127 |
|
| 128 |
-
|
| 129 |
-
label="Number of inference steps",
|
| 130 |
-
minimum=1,
|
| 131 |
-
maximum=50,
|
| 132 |
-
step=1,
|
| 133 |
-
value=2, # Replace with defaults that work for your model
|
| 134 |
-
)
|
| 135 |
|
| 136 |
gr.Examples(examples=examples, inputs=[prompt])
|
| 137 |
gr.on(
|
|
|
|
| 67 |
with gr.Blocks(css=css) as demo:
|
| 68 |
with gr.Column(elem_id="col-container"):
|
| 69 |
gr.Markdown(" # Text-to-Image Gradio Template")
|
| 70 |
+
prompt = gr.Text(
|
| 71 |
+
label="Prompt",
|
| 72 |
+
show_label=False,
|
| 73 |
+
max_lines=1,
|
| 74 |
+
placeholder="Enter your prompt",
|
| 75 |
+
container=False,
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
negative_prompt = gr.Text(
|
| 79 |
+
label="Negative prompt",
|
| 80 |
+
max_lines=1,
|
| 81 |
+
placeholder="Enter a negative prompt",
|
| 82 |
+
visible=False,
|
| 83 |
+
)
|
| 84 |
+
seed = gr.Slider(
|
| 85 |
+
label="Seed",
|
| 86 |
+
minimum=0,
|
| 87 |
+
maximum=MAX_SEED,
|
| 88 |
+
step=1,
|
| 89 |
+
value=42,
|
| 90 |
+
)
|
| 91 |
+
guidance_scale = gr.Slider(
|
| 92 |
+
label="Guidance scale",
|
| 93 |
+
minimum=0.0,
|
| 94 |
+
maximum=10.0,
|
| 95 |
+
step=0.1,
|
| 96 |
+
value=7.0, # Replace with defaults that work for your model
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
num_inference_steps = gr.Slider(
|
| 100 |
+
label="Number of inference steps",
|
| 101 |
+
minimum=1,
|
| 102 |
+
maximum=50,
|
| 103 |
+
step=1,
|
| 104 |
+
value=20, # Replace with defaults that work for your model
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
run_button = gr.Button("Run", scale=0, variant="primary")
|
|
|
|
| 108 |
|
| 109 |
result = gr.Image(label="Result", show_label=False)
|
| 110 |
+
|
| 111 |
|
| 112 |
with gr.Accordion("Advanced Settings", open=False):
|
| 113 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
width = gr.Slider(
|
|
|
|
| 133 |
value=1024, # Replace with defaults that work for your model
|
| 134 |
)
|
| 135 |
|
| 136 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
gr.Examples(examples=examples, inputs=[prompt])
|
| 141 |
gr.on(
|