Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -19,10 +19,9 @@ css = """
|
|
19 |
|
20 |
|
21 |
@spaces.GPU
|
22 |
-
def infer(prompt,
|
23 |
return model.text2image(
|
24 |
prompt=[prompt],
|
25 |
-
negative_prompt=[negative_prompt],
|
26 |
guidance_scale=guidance_scale,
|
27 |
num_inference_steps=num_inference_steps,
|
28 |
width=width,
|
@@ -39,7 +38,6 @@ with gr.Blocks(css=css) as demo:
|
|
39 |
run_button = gr.Button("Run", scale=0)
|
40 |
result = gr.Image(label="Result", show_label=False)
|
41 |
with gr.Accordion("Advanced Settings", open=False):
|
42 |
-
negative_prompt = gr.Text(label="Negative Prompt", max_lines=1, placeholder="Enter a negative prompt")
|
43 |
seed = gr.Slider(label="Seed", minimum=0, maximum=1_000_000, step=1, value=0)
|
44 |
with gr.Row():
|
45 |
width = gr.Slider(label="Width", minimum=256, maximum=1344, step=64, value=1024)
|
@@ -49,9 +47,9 @@ with gr.Blocks(css=css) as demo:
|
|
49 |
num_inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=50, step=1, value=50)
|
50 |
gr.Examples(examples=examples, inputs=[prompt])
|
51 |
gr.on(
|
52 |
-
triggers=[run_button.click, prompt.submit
|
53 |
fn=infer,
|
54 |
-
inputs=[prompt,
|
55 |
outputs=[result]
|
56 |
)
|
57 |
demo.launch(server_name="0.0.0.0")
|
|
|
19 |
|
20 |
|
21 |
@spaces.GPU
|
22 |
+
def infer(prompt, seed, width, height, guidance_scale, num_inference_steps):
|
23 |
return model.text2image(
|
24 |
prompt=[prompt],
|
|
|
25 |
guidance_scale=guidance_scale,
|
26 |
num_inference_steps=num_inference_steps,
|
27 |
width=width,
|
|
|
38 |
run_button = gr.Button("Run", scale=0)
|
39 |
result = gr.Image(label="Result", show_label=False)
|
40 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
41 |
seed = gr.Slider(label="Seed", minimum=0, maximum=1_000_000, step=1, value=0)
|
42 |
with gr.Row():
|
43 |
width = gr.Slider(label="Width", minimum=256, maximum=1344, step=64, value=1024)
|
|
|
47 |
num_inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=50, step=1, value=50)
|
48 |
gr.Examples(examples=examples, inputs=[prompt])
|
49 |
gr.on(
|
50 |
+
triggers=[run_button.click, prompt.submit],
|
51 |
fn=infer,
|
52 |
+
inputs=[prompt, seed, width, height, guidance_scale, num_inference_steps],
|
53 |
outputs=[result]
|
54 |
)
|
55 |
demo.launch(server_name="0.0.0.0")
|