Spaces:
Runtime error
Runtime error
small UI layout improvements (#3)
Browse files- small UI layout improvements (79fe32938357895466ee185ae29c42bb44db884d)
- Update app.py (2fa27441602d6dd948787089289ae125c2daf3de)
Co-authored-by: Linoy Tsaban <[email protected]>
app.py
CHANGED
|
@@ -123,6 +123,13 @@ def create_interface():
|
|
| 123 |
"Snoopy", "Van_Gogh", "Vector"
|
| 124 |
]
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
# Example data
|
| 127 |
examples = [
|
| 128 |
["3D_Chibi", "", "3D Chibi style, Two smiling colleagues enthusiastically high-five in front of a whiteboard filled with technical notes about multimodal learning, reflecting a moment of success and collaboration at OpenAI.",
|
|
@@ -152,29 +159,33 @@ def create_interface():
|
|
| 152 |
|
| 153 |
with gr.Row():
|
| 154 |
with gr.Column(scale=1):
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
demo_lora_names, label="Select built-in LoRA")
|
| 157 |
-
|
| 158 |
label="Enter Custom LoRA",
|
| 159 |
placeholder="LoRA Hugging Face path (e.g., 'username/repo_name')",
|
| 160 |
info="If you want to use a custom LoRA, enter its Hugging Face repo ID here and built-in LoRA will be Overridden. Leave empty to use built-in LoRAs. [Check the list of FLUX LoRAs](https://huggingface.co/models?other=base_model:adapter:black-forest-labs/FLUX.1-dev)"
|
| 161 |
)
|
| 162 |
-
|
| 163 |
-
placeholder="Enter your prompt here",
|
| 164 |
-
info="Remember to include the necessary trigger words if you're using a custom LoRA."
|
| 165 |
-
)
|
| 166 |
-
image_input = gr.Image(type="pil", label="Upload Image")
|
| 167 |
with gr.Column(scale=1):
|
| 168 |
output_image = gr.ImageSlider(label="Generated Image")
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
gr.Examples(
|
| 180 |
examples=examples,
|
|
|
|
| 123 |
"Snoopy", "Van_Gogh", "Vector"
|
| 124 |
]
|
| 125 |
|
| 126 |
+
def update_trigger_word(lora_name, prompt):
|
| 127 |
+
for name in demo_lora_names:
|
| 128 |
+
trigger = " ".join(name.split("_")) + " style,"
|
| 129 |
+
prompt = prompt.replace(trigger, "")
|
| 130 |
+
new_trigger = " ".join(lora_name.split("_"))+ " style,"
|
| 131 |
+
return new_trigger + prompt
|
| 132 |
+
|
| 133 |
# Example data
|
| 134 |
examples = [
|
| 135 |
["3D_Chibi", "", "3D Chibi style, Two smiling colleagues enthusiastically high-five in front of a whiteboard filled with technical notes about multimodal learning, reflecting a moment of success and collaboration at OpenAI.",
|
|
|
|
| 159 |
|
| 160 |
with gr.Row():
|
| 161 |
with gr.Column(scale=1):
|
| 162 |
+
image_input = gr.Image(type="pil", label="Upload Image")
|
| 163 |
+
prompt_box = gr.Textbox(label="Prompt",
|
| 164 |
+
value="3D Chibi style,",
|
| 165 |
+
info="Remember to include the necessary trigger words if you're using a custom LoRA."
|
| 166 |
+
)
|
| 167 |
+
lora_dropdown = gr.Dropdown(
|
| 168 |
demo_lora_names, label="Select built-in LoRA")
|
| 169 |
+
custom_repo_box = gr.Textbox(
|
| 170 |
label="Enter Custom LoRA",
|
| 171 |
placeholder="LoRA Hugging Face path (e.g., 'username/repo_name')",
|
| 172 |
info="If you want to use a custom LoRA, enter its Hugging Face repo ID here and built-in LoRA will be Overridden. Leave empty to use built-in LoRAs. [Check the list of FLUX LoRAs](https://huggingface.co/models?other=base_model:adapter:black-forest-labs/FLUX.1-dev)"
|
| 173 |
)
|
| 174 |
+
gen_btn = gr.Button("Generate")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
with gr.Column(scale=1):
|
| 176 |
output_image = gr.ImageSlider(label="Generated Image")
|
| 177 |
+
with gr.Accordion("Advanced Options", open=False):
|
| 178 |
+
height_box = gr.Textbox(value="1024", label="Height")
|
| 179 |
+
width_box = gr.Textbox(value="1024", label="Width")
|
| 180 |
+
guidance_slider = gr.Slider(
|
| 181 |
+
0.1, 20, value=3.5, step=0.1, label="Guidance Scale")
|
| 182 |
+
steps_slider = gr.Slider(
|
| 183 |
+
1, 50, value=25, step=1, label="Inference Steps")
|
| 184 |
+
seed_slider = gr.Slider(
|
| 185 |
+
1, 2_147_483_647, value=42, step=1, label="Seed")
|
| 186 |
+
|
| 187 |
+
lora_dropdown.select(fn=update_trigger_word, inputs=[lora_dropdown,prompt_box],
|
| 188 |
+
outputs=prompt_box)
|
| 189 |
|
| 190 |
gr.Examples(
|
| 191 |
examples=examples,
|