John6666 commited on
Commit
dfc06f2
·
verified ·
1 Parent(s): 0f865da

Upload 5 files

Browse files
Files changed (2) hide show
  1. app.py +25 -16
  2. requirements.txt +1 -1
app.py CHANGED
@@ -87,45 +87,54 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
87
  vae_model = gr.Dropdown(label="VAE Model", choices=get_vaes(), value=get_vaes()[0])
88
 
89
  with gr.Accordion("LoRA", open=True, visible=True):
 
 
 
 
 
 
 
 
 
90
  with gr.Row():
91
  with gr.Column():
92
  with gr.Row():
93
- lora1 = gr.Dropdown(label="LoRA 1", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
94
- lora1_wt = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA 1: weight")
95
  with gr.Row():
96
- lora1_info = gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
97
  lora1_copy = gr.Button(value="Copy example to prompt", visible=False)
98
  lora1_md = gr.Markdown(value="", visible=False)
99
  with gr.Column():
100
  with gr.Row():
101
- lora2 = gr.Dropdown(label="LoRA 2", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
102
- lora2_wt = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA 2: weight")
103
  with gr.Row():
104
- lora2_info = gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
105
  lora2_copy = gr.Button(value="Copy example to prompt", visible=False)
106
  lora2_md = gr.Markdown(value="", visible=False)
107
  with gr.Column():
108
  with gr.Row():
109
- lora3 = gr.Dropdown(label="LoRA 3", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
110
- lora3_wt = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA 3: weight")
111
  with gr.Row():
112
- lora3_info = gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
113
  lora3_copy = gr.Button(value="Copy example to prompt", visible=False)
114
  lora3_md = gr.Markdown(value="", visible=False)
115
  with gr.Column():
116
  with gr.Row():
117
- lora4 = gr.Dropdown(label="LoRA 4", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
118
- lora4_wt = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA 4: weight")
119
  with gr.Row():
120
- lora4_info = gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
121
  lora4_copy = gr.Button(value="Copy example to prompt", visible=False)
122
  lora4_md = gr.Markdown(value="", visible=False)
123
  with gr.Column():
124
  with gr.Row():
125
- lora5 = gr.Dropdown(label="LoRA 5", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
126
- lora5_wt = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA 5: weight")
127
  with gr.Row():
128
- lora5_info = gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
129
  lora5_copy = gr.Button(value="Copy example to prompt", visible=False)
130
  lora5_md = gr.Markdown(value="", visible=False)
131
  with gr.Accordion("From URL", open=True, visible=True):
@@ -137,7 +146,7 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
137
  lora_search_civitai_result = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
138
  lora_search_civitai_json = gr.JSON(value={}, visible=False)
139
  lora_search_civitai_desc = gr.Markdown(value="", visible=False)
140
- lora_download_url = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
141
  lora_download = gr.Button("Get and set LoRA and apply to prompt")
142
 
143
  with gr.Row():
 
87
  vae_model = gr.Dropdown(label="VAE Model", choices=get_vaes(), value=get_vaes()[0])
88
 
89
  with gr.Accordion("LoRA", open=True, visible=True):
90
+ def lora_dropdown(label):
91
+ return gr.Dropdown(label=label, choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
92
+
93
+ def lora_scale_slider(label):
94
+ return gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label=label)
95
+
96
+ def lora_textbox():
97
+ return gr.Textbox(label="", info="Example of prompt:", value="", show_copy_button=True, interactive=False, visible=False)
98
+
99
  with gr.Row():
100
  with gr.Column():
101
  with gr.Row():
102
+ lora1 = lora_dropdown("LoRA 1")
103
+ lora1_wt = lora_scale_slider("LoRA 1: weight")
104
  with gr.Row():
105
+ lora1_info = lora_textbox()
106
  lora1_copy = gr.Button(value="Copy example to prompt", visible=False)
107
  lora1_md = gr.Markdown(value="", visible=False)
108
  with gr.Column():
109
  with gr.Row():
110
+ lora2 = lora_dropdown("LoRA 2")
111
+ lora2_wt = lora_scale_slider("LoRA 2: weight")
112
  with gr.Row():
113
+ lora2_info = lora_textbox()
114
  lora2_copy = gr.Button(value="Copy example to prompt", visible=False)
115
  lora2_md = gr.Markdown(value="", visible=False)
116
  with gr.Column():
117
  with gr.Row():
118
+ lora3 = lora_dropdown("LoRA 3")
119
+ lora3_wt = lora_scale_slider("LoRA 3: weight")
120
  with gr.Row():
121
+ lora3_info = lora_textbox()
122
  lora3_copy = gr.Button(value="Copy example to prompt", visible=False)
123
  lora3_md = gr.Markdown(value="", visible=False)
124
  with gr.Column():
125
  with gr.Row():
126
+ lora4 = lora_dropdown("LoRA 4")
127
+ lora4_wt = lora_scale_slider("LoRA 4: weight")
128
  with gr.Row():
129
+ lora4_info = lora_textbox()
130
  lora4_copy = gr.Button(value="Copy example to prompt", visible=False)
131
  lora4_md = gr.Markdown(value="", visible=False)
132
  with gr.Column():
133
  with gr.Row():
134
+ lora5 = lora_dropdown("LoRA 5")
135
+ lora5_wt = lora_scale_slider("LoRA 5: weight")
136
  with gr.Row():
137
+ lora5_info = lora_textbox()
138
  lora5_copy = gr.Button(value="Copy example to prompt", visible=False)
139
  lora5_md = gr.Markdown(value="", visible=False)
140
  with gr.Accordion("From URL", open=True, visible=True):
 
146
  lora_search_civitai_result = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
147
  lora_search_civitai_json = gr.JSON(value={}, visible=False)
148
  lora_search_civitai_desc = gr.Markdown(value="", visible=False)
149
+ lora_download_url = gr.Textbox(label="LoRA URL", placeholder="https://civitai.com/api/download/models/28907", lines=1)
150
  lora_download = gr.Button("Get and set LoRA and apply to prompt")
151
 
152
  with gr.Row():
requirements.txt CHANGED
@@ -4,7 +4,7 @@ diffusers
4
  invisible_watermark
5
  transformers
6
  xformers
7
- git+https://github.com/R3gm/stablepy.git
8
  torch==2.2.0
9
  gdown
10
  opencv-python
 
4
  invisible_watermark
5
  transformers
6
  xformers
7
+ git+https://github.com/R3gm/stablepy.git@flux_beta
8
  torch==2.2.0
9
  gdown
10
  opencv-python