ClaireOzzz commited on
Commit
86f8895
1 Parent(s): 4e44d79

changed layout

Browse files
Files changed (1) hide show
  1. app.py +30 -20
app.py CHANGED
@@ -4,7 +4,6 @@ os.system('pip install spaces==0.18.0')
4
  os.system('pip install gradio==4.0.2')
5
 
6
 
7
-
8
  import gradio as gr
9
  from huggingface_hub import login, HfFileSystem, HfApi, ModelCard
10
  import os
@@ -284,14 +283,18 @@ theme = gr.themes.Soft(
284
  button_secondary_border_color_dark='*neutral_200',
285
  button_secondary_text_color_dark='*neutral_800'
286
  )
287
-
 
 
 
288
  with gr.Blocks(theme=theme, css=css) as demo:
 
289
  with gr.Column(elem_id="col-container"):
290
 
291
  gr.HTML("""
292
- <h2 style="text-align: center;">SD-XL Control LoRas</h2>
293
- <p style="text-align: center;">Use StableDiffusion XL with <a href="https://huggingface.co/collections/diffusers/sdxl-controlnets-64f9c35846f3f06f5abe351f">Diffusers' SDXL ControlNets</a></p>
294
- """)
295
 
296
  use_custom_model = gr.Checkbox(label="Use a custom pre-trained LoRa model ? (optional)", visible = False, value=False, info="To use a private model, you'll need to duplicate the space with your own access token.")
297
 
@@ -338,24 +341,32 @@ with gr.Blocks(theme=theme, css=css) as demo:
338
  )
339
  trigger_word = gr.Textbox(label="Trigger word", interactive=False, visible=False)
340
 
341
- image_in = gr.Image(sources="upload", type="filepath")
342
-
 
 
 
 
 
 
 
 
 
 
343
  with gr.Row():
344
 
345
  with gr.Column():
346
- with gr.Group():
347
- prompt = gr.Textbox(label="Prompt")
 
 
 
348
  negative_prompt = gr.Textbox(label="Negative prompt", value="extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured")
349
- with gr.Group():
350
- guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=7.5)
351
  inf_steps = gr.Slider(label="Inference Steps", minimum="25", maximum="50", step=1, value=25)
352
- custom_lora_weight = gr.Slider(label="Custom model weights", minimum=0.1, maximum=0.9, step=0.1, value=0.9)
353
-
354
- with gr.Column():
355
- with gr.Group():
356
  preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny"], value="canny", interactive=False, info="For the moment, only canny is available")
357
- controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.5)
358
- with gr.Group():
359
  seed = gr.Slider(
360
  label="Seed",
361
  info = "-1 denotes a random seed",
@@ -368,11 +379,10 @@ with gr.Blocks(theme=theme, css=css) as demo:
368
  label = "Last used seed",
369
  info = "the seed used in the last generation",
370
  )
371
-
372
- load_model_btn = gr.Button("Load my model", elem_id="load_model_btn")
373
  submit_btn = gr.Button("Submit")
374
 
375
- result = gr.Image(label="Result")
376
 
377
  use_custom_model.change(
378
  fn = check_use_custom_or_no,
 
4
  os.system('pip install gradio==4.0.2')
5
 
6
 
 
7
  import gradio as gr
8
  from huggingface_hub import login, HfFileSystem, HfApi, ModelCard
9
  import os
 
283
  button_secondary_border_color_dark='*neutral_200',
284
  button_secondary_text_color_dark='*neutral_800'
285
  )
286
+
287
+ #examples = [["examples/" + img] for img in os.listdir("examples/")]
288
+ im = gr.Image(visible=False)
289
+
290
  with gr.Blocks(theme=theme, css=css) as demo:
291
+ with gr.Row():
292
  with gr.Column(elem_id="col-container"):
293
 
294
  gr.HTML("""
295
+ <h2 style="text-align: left;">Choose a Style</h2>
296
+ <p style="text-align: left;">Our Pretrained Models can be found on Huggingface</p>
297
+ """)
298
 
299
  use_custom_model = gr.Checkbox(label="Use a custom pre-trained LoRa model ? (optional)", visible = False, value=False, info="To use a private model, you'll need to duplicate the space with your own access token.")
300
 
 
341
  )
342
  trigger_word = gr.Textbox(label="Trigger word", interactive=False, visible=False)
343
 
344
+ load_model_btn = gr.Button("Load my model", elem_id="load_model_btn")
345
+ image_in = gr.Image(sources="upload", type="filepath", value=( "baby.jpg"))
346
+ gr.Examples(
347
+ examples=[[os.path.join(os.path.dirname(__file__), "baby.jpg")],[os.path.join(os.path.dirname(__file__), "baby.jpg")]], inputs=im)
348
+
349
+
350
+ with gr.Column(elem_id="col-container"):
351
+ gr.HTML("""
352
+ <h2 style="text-align: left;">Input a Prompt!</h2>
353
+ <p style="text-align: left;">Negative prompts and other settings can be found in advanced options</p>
354
+ """)
355
+
356
  with gr.Row():
357
 
358
  with gr.Column():
359
+ # with gr.Group():
360
+ prompt = gr.Textbox(label="Prompt", placeholder="Add your trigger word here + prompt")
361
+
362
+ with gr.Accordion(label="Advanced Options", open=False):
363
+ # with gr.Group():
364
  negative_prompt = gr.Textbox(label="Negative prompt", value="extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured")
365
+ guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=8.8)
 
366
  inf_steps = gr.Slider(label="Inference Steps", minimum="25", maximum="50", step=1, value=25)
367
+ custom_lora_weight = gr.Slider(label="Custom model weights", minimum=0.1, maximum=0.9, step=0.1, value=0.7)
 
 
 
368
  preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny"], value="canny", interactive=False, info="For the moment, only canny is available")
369
+ controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.3)
 
370
  seed = gr.Slider(
371
  label="Seed",
372
  info = "-1 denotes a random seed",
 
379
  label = "Last used seed",
380
  info = "the seed used in the last generation",
381
  )
382
+
 
383
  submit_btn = gr.Button("Submit")
384
 
385
+ result = gr.Image(label="Result", visible=False)
386
 
387
  use_custom_model.change(
388
  fn = check_use_custom_or_no,