John6666 commited on
Commit
d65f8f9
·
verified ·
1 Parent(s): 29cdb8f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -15,6 +15,20 @@ loras = [
15
  ]
16
  schedulers = list(SCHEDULER_CONFIG_MAP.keys())
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  css = """"""
19
 
20
  with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
@@ -37,7 +51,7 @@ It saves you the trouble of typing them in.<br>
37
  - Input your new repo name. If empty, auto-complete. e.g. 'newrepo'.
38
  - Set the parameters. If not sure, just use the defaults.
39
  - Click "Submit".
40
- - Patiently wait until the output changes.
41
  """
42
  )
43
  with gr.Column():
@@ -47,6 +61,7 @@ It saves you the trouble of typing them in.<br>
47
  hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
48
  civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
49
  is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
 
50
  with gr.Accordion("Advanced settings", open=False):
51
  is_half = gr.Checkbox(label="Half precision", value=True)
52
  model_type = gr.Radio(label="Model type", choices=["v1", "v2"], value="v1")
@@ -77,6 +92,13 @@ It saves you the trouble of typing them in.<br>
77
  model_type, sample_size, ema],
78
  outputs=[repo_urls, output_md],
79
  )
 
 
 
 
 
 
 
80
 
81
  demo.queue()
82
  demo.launch()
 
15
  ]
16
  schedulers = list(SCHEDULER_CONFIG_MAP.keys())
17
 
18
+ preset_dict = {
19
+ "Default": [True, "", "Euler", "", 1.0, "", 1.0, "", 1.0, "", 1.0, "", 1.0, "v1", 768, "ema"],
20
+ "Bake in standard VAE": [True, "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt",
21
+ "Euler", "", 1.0, "", 1.0, "", 1.0, "", 1.0, "", 1.0, "v1", 768, "ema"],
22
+ }
23
+
24
+
25
+ def set_presets(preset: str="Default"):
26
+ p = []
27
+ if preset in preset_dict.keys(): p = preset_dict[preset]
28
+ else: p = preset_dict["Default"]
29
+ return p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]
30
+
31
+
32
  css = """"""
33
 
34
  with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
 
51
  - Input your new repo name. If empty, auto-complete. e.g. 'newrepo'.
52
  - Set the parameters. If not sure, just use the defaults.
53
  - Click "Submit".
54
+ - Patiently wait until the output changes. It takes approximately 1 minutes (downloading from HF).
55
  """
56
  )
57
  with gr.Column():
 
61
  hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
62
  civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
63
  is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
64
+ presets = gr.Radio(label="Presets", choices=list(preset_dict.keys()), value="Default")
65
  with gr.Accordion("Advanced settings", open=False):
66
  is_half = gr.Checkbox(label="Half precision", value=True)
67
  model_type = gr.Radio(label="Model type", choices=["v1", "v2"], value="v1")
 
92
  model_type, sample_size, ema],
93
  outputs=[repo_urls, output_md],
94
  )
95
+ presets.change(
96
+ fn=set_presets,
97
+ inputs=[presets],
98
+ outputs=[is_half, vae, scheduler, lora1, lora1s, lora2, lora2s, lora3, lora3s, lora4, lora4s, lora5, lora5s,
99
+ model_type, sample_size, ema],
100
+ queue=False,
101
+ )
102
 
103
  demo.queue()
104
  demo.launch()