Spaces:
Running
on
Zero
Running
on
Zero
AlekseyCalvin
commited on
Commit
•
38d4ed7
1
Parent(s):
ace98a5
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ with open('loras.json', 'r') as f:
|
|
14 |
loras = json.load(f)
|
15 |
|
16 |
# Initialize the base model
|
17 |
-
base_model = "
|
18 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16)
|
19 |
|
20 |
MAX_SEED = 2**32-1
|
@@ -110,13 +110,17 @@ css = '''
|
|
110 |
'''
|
111 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
112 |
title = gr.HTML(
|
113 |
-
"""<h1><img src="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer/resolve/main/flux_lora.png" alt="LoRA">
|
114 |
elem_id="title",
|
|
|
|
|
|
|
|
|
115 |
)
|
116 |
selected_index = gr.State(None)
|
117 |
with gr.Row():
|
118 |
with gr.Column(scale=3):
|
119 |
-
prompt = gr.Textbox(label="Prompt", lines=1, placeholder="
|
120 |
with gr.Column(scale=1, elem_id="gen_column"):
|
121 |
generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
|
122 |
with gr.Row():
|
@@ -124,7 +128,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
124 |
selected_info = gr.Markdown("")
|
125 |
gallery = gr.Gallery(
|
126 |
[(item["image"], item["title"]) for item in loras],
|
127 |
-
label="LoRA
|
128 |
allow_preview=False,
|
129 |
columns=3,
|
130 |
elem_id="gallery"
|
@@ -134,15 +138,15 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
134 |
result = gr.Image(label="Generated Image")
|
135 |
|
136 |
with gr.Row():
|
137 |
-
with gr.Accordion("Advanced Settings", open=
|
138 |
with gr.Column():
|
139 |
with gr.Row():
|
140 |
-
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=
|
141 |
-
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=
|
142 |
|
143 |
with gr.Row():
|
144 |
-
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=
|
145 |
-
height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=
|
146 |
|
147 |
with gr.Row():
|
148 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
@@ -162,5 +166,5 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
162 |
outputs=[result, seed]
|
163 |
)
|
164 |
|
165 |
-
app.queue()
|
166 |
-
app.launch()
|
|
|
14 |
loras = json.load(f)
|
15 |
|
16 |
# Initialize the base model
|
17 |
+
base_model = "sayakpaul/FLUX.1-merged"
|
18 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16)
|
19 |
|
20 |
MAX_SEED = 2**32-1
|
|
|
110 |
'''
|
111 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
112 |
title = gr.HTML(
|
113 |
+
"""<h1><img src="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer/resolve/main/flux_lora.png" alt="LoRA"> SOONfactory </h1>""",
|
114 |
elem_id="title",
|
115 |
+
)
|
116 |
+
# Info blob stating what the app is running
|
117 |
+
info_blob = gr.HTML(
|
118 |
+
"""<div id="info_blob"> Activist, Futurist, and Realist LoRa-stocked Quick-Use Image Manufactory (over Flux Schnell)</div>"""
|
119 |
)
|
120 |
selected_index = gr.State(None)
|
121 |
with gr.Row():
|
122 |
with gr.Column(scale=3):
|
123 |
+
prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Select LoRa/Style & type prompt!")
|
124 |
with gr.Column(scale=1, elem_id="gen_column"):
|
125 |
generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
|
126 |
with gr.Row():
|
|
|
128 |
selected_info = gr.Markdown("")
|
129 |
gallery = gr.Gallery(
|
130 |
[(item["image"], item["title"]) for item in loras],
|
131 |
+
label="LoRA Inventory",
|
132 |
allow_preview=False,
|
133 |
columns=3,
|
134 |
elem_id="gallery"
|
|
|
138 |
result = gr.Image(label="Generated Image")
|
139 |
|
140 |
with gr.Row():
|
141 |
+
with gr.Accordion("Advanced Settings", open=True):
|
142 |
with gr.Column():
|
143 |
with gr.Row():
|
144 |
+
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=1, value=3)
|
145 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=6)
|
146 |
|
147 |
with gr.Row():
|
148 |
+
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=768)
|
149 |
+
height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=768)
|
150 |
|
151 |
with gr.Row():
|
152 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
|
|
166 |
outputs=[result, seed]
|
167 |
)
|
168 |
|
169 |
+
app.queue(default_concurrency_limit=2).launch(show_error=True)
|
170 |
+
app.launch()
|