Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,62 +81,56 @@ def infer(
|
|
| 81 |
return image, seed, json_prompt, json.dumps(neg_json_prompt), gr.update(open=True)
|
| 82 |
|
| 83 |
|
| 84 |
-
css =
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
max-width: 1000px;
|
| 88 |
-
}
|
| 89 |
-
"""
|
| 90 |
|
| 91 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="violet")) as demo:
|
| 92 |
-
|
| 93 |
|
| 94 |
-
with gr.Column():
|
| 95 |
gr.Markdown("## FIBO")
|
| 96 |
-
with gr.Row(elem_id="col-container"):
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
with gr.Row():
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
)
|
| 118 |
-
|
| 119 |
-
submit_btn = gr.Button("Generate", variant="primary")
|
| 120 |
-
|
| 121 |
-
with gr.Accordion("Advanced Settings", open=False):
|
| 122 |
-
with gr.Row():
|
| 123 |
-
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
| 124 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 125 |
-
with gr.Row():
|
| 126 |
-
guidance_scale = gr.Slider(label="guidance scale", minimum=1.0, maximum=10.0, step=0.1, value=5.0)
|
| 127 |
-
num_inference_steps = gr.Slider(
|
| 128 |
-
label="number of inference steps", minimum=1, maximum=60, step=1, value=50
|
| 129 |
-
)
|
| 130 |
-
height = gr.Slider(label="Height", minimum=768, maximum=1248, step=32, value=1024)
|
| 131 |
-
width = gr.Slider(label="Width", minimum=832, maximum=1344, step=64, value=1024)
|
| 132 |
-
with gr.Row():
|
| 133 |
-
negative_prompt = gr.Textbox(label="negative prompt")
|
| 134 |
-
negative_prompt_json = gr.JSON(label="json negative prompt")
|
| 135 |
-
|
| 136 |
-
with gr.Column(scale=1):
|
| 137 |
-
result = gr.Image(label="output")
|
| 138 |
-
with gr.Accordion("Structured Prompt", open=False) as structured_accordion:
|
| 139 |
-
prompt_in_json = gr.JSON(label="json structured prompt")
|
| 140 |
|
| 141 |
# Track active tab
|
| 142 |
current_mode = gr.State("generate")
|
|
|
|
| 81 |
return image, seed, json_prompt, json.dumps(neg_json_prompt), gr.update(open=True)
|
| 82 |
|
| 83 |
|
| 84 |
+
css = '''
|
| 85 |
+
.fillable{max-width: 960px !important}
|
| 86 |
+
'''
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="violet")) as demo:
|
|
|
|
| 89 |
|
|
|
|
| 90 |
gr.Markdown("## FIBO")
|
|
|
|
| 91 |
|
| 92 |
+
with gr.Column(scale=1):
|
| 93 |
+
with gr.Row():
|
| 94 |
+
with gr.Tab("generate") as tab_generate:
|
| 95 |
+
prompt_generate = gr.Textbox(
|
| 96 |
+
label="Prompt",
|
| 97 |
+
placeholder="a man holding a goose screaming"
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
with gr.Tab("refine") as tab_refine:
|
| 101 |
+
prompt_refine = gr.Textbox(
|
| 102 |
+
label="Prompt",
|
| 103 |
+
info="describe the change you want to make",
|
| 104 |
+
placeholder="make the cat white"
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
with gr.Tab("inspire") as tab_inspire:
|
| 108 |
+
prompt_inspire_image = gr.Image(
|
| 109 |
+
label="Inspiration Image",
|
| 110 |
+
type="pil",
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
submit_btn = gr.Button("Generate", variant="primary")
|
| 114 |
+
|
| 115 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 116 |
with gr.Row():
|
| 117 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
| 118 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 119 |
+
with gr.Row():
|
| 120 |
+
guidance_scale = gr.Slider(label="guidance scale", minimum=1.0, maximum=10.0, step=0.1, value=5.0)
|
| 121 |
+
num_inference_steps = gr.Slider(
|
| 122 |
+
label="number of inference steps", minimum=1, maximum=60, step=1, value=50
|
| 123 |
+
)
|
| 124 |
+
height = gr.Slider(label="Height", minimum=768, maximum=1248, step=32, value=1024)
|
| 125 |
+
width = gr.Slider(label="Width", minimum=832, maximum=1344, step=64, value=1024)
|
| 126 |
+
with gr.Row():
|
| 127 |
+
negative_prompt = gr.Textbox(label="negative prompt")
|
| 128 |
+
negative_prompt_json = gr.JSON(label="json negative prompt")
|
| 129 |
+
|
| 130 |
+
with gr.Column(scale=1):
|
| 131 |
+
result = gr.Image(label="output")
|
| 132 |
+
with gr.Accordion("Structured Prompt", open=False) as structured_accordion:
|
| 133 |
+
prompt_in_json = gr.JSON(label="json structured prompt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
# Track active tab
|
| 136 |
current_mode = gr.State("generate")
|