Spaces:
Sleeping
Sleeping
update app.py
Browse files26 unmodified lines27282930313233343536373839404131 unmodified lines7374757677781 unmodified line808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412 unmodified lines1371381391401411421431441451461471481491501511521531541551561571584 unmodified lines16316416516616716816926 unmodified linesprompt,negative_prompt,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)print(f"Model id: {model_id}")pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)31 unmodified lineswith gr.Column(elem_id="col-container"):gr.Markdown(" # Text-to-Image Gradio Template")prompt = gr.Text(label="Prompt",show_label=False,1 unmodified lineplaceholder="Enter your prompt",container=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,)randomize_seed = gr.Checkbox(label="Randomize seed", value=True)with gr.Row():width = gr.Slider(12 unmodified linesvalue=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 linesprompt,negative_prompt,seed,randomize_seed,width,height,guidance_scale,26 unmodified lines27282930313233343536373839404131 unmodified lines73747576777879808182838485861 unmodified line88899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913012 unmodified lines1431441451461471484 unmodified lines15315415515615715826 unmodified linesprompt,negative_prompt,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)print(f"Model id: {model_id}")pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)31 unmodified lineswith 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 lineplaceholder="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():seed = gr.Slider(label="Seed",minimum=0,maximum=MAX_SEED,step=1,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")result = gr.Image(label="Result", show_label=False)with gr.Accordion("Advanced Settings", open=False):with gr.Row():width = gr.Slider(12 unmodified linesvalue=1024, # Replace with defaults that work for your model)gr.Examples(examples=examples, inputs=[prompt])gr.on(4 unmodified linesprompt,negative_prompt,seed,width,height,guidance_scale,
app.py+39-50