Spaces:
Sleeping
Sleeping
update app.py
Browse files26 unmodified lines27282930303132333435363738373839404131 unmodified lines73747576777879808182838485861 unmodified line88899091929394959697988586878889909192939495969798991001011021031041051061071081091101111129910010110210311810410510610710810911011111211311411511611711811912012112212312412112512612712812913012 unmodified lines1431441451401411421431441451461471481491501511521531541551461471484 unmodified lines15315415516615615715826 unmodified lines prompt, negative_prompt, seed, randomize_seed, # randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True),): if randomize_seed: seed = random.randint(0, MAX_SEED) # if randomize_seed: # seed = random.randint(0, MAX_SEED)
print(f"Model id: {model_id}") pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)31 unmodified lines with gr.Column(elem_id="col-container"): gr.Markdown(" # Text-to-Image Gradio Template")
model_id = gr.Text( label="Model ID", show_label=False, max_lines=1, placeholder="Enter model id", container=False, value="CompVis/stable-diffusion-v1-4", ) prompt = gr.Text( label="Prompt", show_label=False,1 unmodified line placeholder="Enter your prompt", container=False, ) negative_prompt = gr.Text( label="Negative prompt", max_lines=1, placeholder="Enter a negative prompt", visible=False, )
with gr.Row(): model_id = gr.Text( label="Model ID", show_label=False, max_lines=1, placeholder="Enter model id", container=False, value="CompVis/stable-diffusion-v1-4", ) # prompt = gr.Text( # label="Prompt", # show_label=False, # max_lines=1, # placeholder="Enter your prompt", # container=False, # )
run_button = gr.Button("Run", scale=0, variant="primary")
result = gr.Image(label="Result", show_label=False)
with gr.Accordion("Advanced Settings", open=False): negative_prompt = gr.Text( label="Negative prompt", max_lines=1, placeholder="Enter a negative prompt", visible=False, )
seed = gr.Slider( label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, value=42, ) guidance_scale = gr.Slider( label="Guidance scale", minimum=0.0, maximum=10.0, step=0.1, value=7.0, # Replace with defaults that work for your model )
with gr.Row(): num_inference_steps = gr.Slider( label="Number of inference steps", minimum=1, maximum=50, step=1, value=20, # Replace with defaults that work for your model ) run_button = gr.Button("Run", scale=0, variant="primary")
randomize_seed = gr.Checkbox(label="Randomize seed", value=True) result = gr.Image(label="Result", show_label=False)
with gr.Accordion("Advanced Settings", open=False):
with gr.Row(): width = gr.Slider(12 unmodified lines value=1024, # Replace with defaults that work for your model )
with gr.Row(): guidance_scale = gr.Slider( label="Guidance scale", minimum=0.0, maximum=10.0, step=0.1, value=0.0, # Replace with defaults that work for your model )
num_inference_steps = gr.Slider( label="Number of inference steps", minimum=1, maximum=50, step=1, value=2, # Replace with defaults that work for your model )
gr.Examples(examples=examples, inputs=[prompt]) gr.on(4 unmodified lines prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale,app.py+39-50