Spaces:
Paused
Paused
playgound with openai dependency 4
Browse files- modules/constants.py +1 -0
- webui.py +88 -0
modules/constants.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
# as in k-diffusion (sampling.py)
|
2 |
MIN_SEED = 0
|
3 |
MAX_SEED = 2**63 - 1
|
|
|
4 |
|
5 |
AUTH_FILENAME = 'auth.json'
|
|
|
1 |
# as in k-diffusion (sampling.py)
|
2 |
MIN_SEED = 0
|
3 |
MAX_SEED = 2**63 - 1
|
4 |
+
MAX_IMAGE_SIZE = 1024
|
5 |
|
6 |
AUTH_FILENAME = 'auth.json'
|
webui.py
CHANGED
@@ -115,6 +115,12 @@ if torch.cuda.is_available():
|
|
115 |
else:
|
116 |
power_device = "CPU"
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
with shared.gradio_root:
|
119 |
gr.Markdown(f"""# <center>zStudios Generative Media AI running on {power_device}</center>""")
|
120 |
with gr.Tab("DALL-E"):
|
@@ -133,6 +139,88 @@ with shared.gradio_root:
|
|
133 |
dalleText.submit(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name="infer_dall_e")
|
134 |
dalleBtn.click(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name=False)
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
with gr.Tab("Fooocus"):
|
137 |
args = ini_args()
|
138 |
if args.api_mode:
|
|
|
115 |
else:
|
116 |
power_device = "CPU"
|
117 |
|
118 |
+
examples = [
|
119 |
+
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
|
120 |
+
"An astronaut riding a green horse",
|
121 |
+
"A delicious ceviche cheesecake slice",
|
122 |
+
]
|
123 |
+
|
124 |
with shared.gradio_root:
|
125 |
gr.Markdown(f"""# <center>zStudios Generative Media AI running on {power_device}</center>""")
|
126 |
with gr.Tab("DALL-E"):
|
|
|
139 |
dalleText.submit(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name="infer_dall_e")
|
140 |
dalleBtn.click(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name=False)
|
141 |
|
142 |
+
with gr.Tab("Stable Diffusion"):
|
143 |
+
with gr.Row():
|
144 |
+
|
145 |
+
sdText = gr.Textbox(label="Prompt",
|
146 |
+
placeholder="Enter your text and then click on the \"Run\" button, "
|
147 |
+
"or simply press the Enter key.")
|
148 |
+
|
149 |
+
sdBtn = gr.Button("Run", scale=0)
|
150 |
+
|
151 |
+
result = gr.Image(label="Image Output")
|
152 |
+
|
153 |
+
with gr.Accordion("Advanced Settings", open=False):
|
154 |
+
|
155 |
+
negative_prompt = gr.Text(
|
156 |
+
label="Negative prompt",
|
157 |
+
max_lines=1,
|
158 |
+
placeholder="Enter a negative prompt",
|
159 |
+
visible=False,
|
160 |
+
)
|
161 |
+
|
162 |
+
seed = gr.Slider(
|
163 |
+
label="Seed",
|
164 |
+
minimum=0,
|
165 |
+
maximum=constants.MAX_SEED,
|
166 |
+
step=1,
|
167 |
+
value=0,
|
168 |
+
)
|
169 |
+
|
170 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
171 |
+
|
172 |
+
with gr.Row():
|
173 |
+
|
174 |
+
width = gr.Slider(
|
175 |
+
label="Width",
|
176 |
+
minimum=256,
|
177 |
+
maximum=constants.MAX_IMAGE_SIZE,
|
178 |
+
step=32,
|
179 |
+
value=512,
|
180 |
+
)
|
181 |
+
|
182 |
+
height = gr.Slider(
|
183 |
+
label="Height",
|
184 |
+
minimum=256,
|
185 |
+
maximum=constants.MAX_IMAGE_SIZE,
|
186 |
+
step=32,
|
187 |
+
value=512,
|
188 |
+
)
|
189 |
+
|
190 |
+
with gr.Row():
|
191 |
+
|
192 |
+
guidance_scale = gr.Slider(
|
193 |
+
label="Guidance scale",
|
194 |
+
minimum=0.0,
|
195 |
+
maximum=10.0,
|
196 |
+
step=0.1,
|
197 |
+
value=0.0,
|
198 |
+
)
|
199 |
+
|
200 |
+
num_inference_steps = gr.Slider(
|
201 |
+
label="Number of inference steps",
|
202 |
+
minimum=1,
|
203 |
+
maximum=12,
|
204 |
+
step=1,
|
205 |
+
value=2,
|
206 |
+
)
|
207 |
+
|
208 |
+
gr.Examples(
|
209 |
+
examples = examples,
|
210 |
+
inputs = [sdText]
|
211 |
+
)
|
212 |
+
|
213 |
+
sdText.submit(
|
214 |
+
fn=inf.infer_stable_diffusion,
|
215 |
+
inputs=[sdText, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
216 |
+
outputs=result,
|
217 |
+
api_name="infer_stable_diffusion")
|
218 |
+
sdBtn.click(
|
219 |
+
fn = inf.infer_stable_diffusion,
|
220 |
+
inputs = [sdText, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
221 |
+
outputs = [result]
|
222 |
+
)
|
223 |
+
|
224 |
with gr.Tab("Fooocus"):
|
225 |
args = ini_args()
|
226 |
if args.api_mode:
|