Spaces:
Runtime error
Runtime error
Another try
Browse files
app.py
CHANGED
|
@@ -138,10 +138,11 @@ def generate_image_handler(x, negative_prompt, fine_edge, fix_perspective, grow_
|
|
| 138 |
|
| 139 |
# --- Gradio UI ---
|
| 140 |
|
| 141 |
-
# CSS FIX:
|
| 142 |
-
#
|
|
|
|
| 143 |
css = """
|
| 144 |
-
#mq-
|
| 145 |
height: 70vh !important;
|
| 146 |
max-height: 800px;
|
| 147 |
width: 100%;
|
|
@@ -149,6 +150,11 @@ css = """
|
|
| 149 |
justify-content: center;
|
| 150 |
align-items: center;
|
| 151 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
.row {
|
| 153 |
display: flex;
|
| 154 |
justify-content: center;
|
|
@@ -164,8 +170,9 @@ with gr.Blocks(title="MagicQuill V2", css=css) as demo:
|
|
| 164 |
""")
|
| 165 |
|
| 166 |
with gr.Row():
|
| 167 |
-
#
|
| 168 |
-
|
|
|
|
| 169 |
|
| 170 |
|
| 171 |
with gr.Row():
|
|
@@ -187,8 +194,6 @@ with gr.Blocks(title="MagicQuill V2", css=css) as demo:
|
|
| 187 |
|
| 188 |
btn.click(
|
| 189 |
generate_image_handler,
|
| 190 |
-
# Note: We do NOT need to explicitly add 'request' to inputs here.
|
| 191 |
-
# Gradio handles type hinting for gr.Request automatically.
|
| 192 |
inputs=[ms, negative_prompt, fine_edge, fix_perspective, grow_size, edge_strength, color_strength, local_strength, seed, steps, cfg],
|
| 193 |
outputs=ms
|
| 194 |
)
|
|
@@ -403,5 +408,4 @@ app = gr.mount_gradio_app(app, demo, path="/", root_path="/demo")
|
|
| 403 |
|
| 404 |
|
| 405 |
if __name__ == "__main__":
|
| 406 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 407 |
-
|
|
|
|
| 138 |
|
| 139 |
# --- Gradio UI ---
|
| 140 |
|
| 141 |
+
# CSS FIX:
|
| 142 |
+
# Since the custom component cannot take an ID, we target the wrapper (#mq-wrapper).
|
| 143 |
+
# We force the wrapper to a fixed height to contain the canvas.
|
| 144 |
css = """
|
| 145 |
+
#mq-wrapper {
|
| 146 |
height: 70vh !important;
|
| 147 |
max-height: 800px;
|
| 148 |
width: 100%;
|
|
|
|
| 150 |
justify-content: center;
|
| 151 |
align-items: center;
|
| 152 |
}
|
| 153 |
+
/* Ensure the component inside fills the wrapper but respects the limits */
|
| 154 |
+
#mq-wrapper > * {
|
| 155 |
+
height: 100%;
|
| 156 |
+
width: 100%;
|
| 157 |
+
}
|
| 158 |
.row {
|
| 159 |
display: flex;
|
| 160 |
justify-content: center;
|
|
|
|
| 170 |
""")
|
| 171 |
|
| 172 |
with gr.Row():
|
| 173 |
+
# FIX: Wrap in a Column with elem_id, since MagicQuillV2 doesn't accept elem_id directly
|
| 174 |
+
with gr.Column(elem_id="mq-wrapper"):
|
| 175 |
+
ms = MagicQuillV2()
|
| 176 |
|
| 177 |
|
| 178 |
with gr.Row():
|
|
|
|
| 194 |
|
| 195 |
btn.click(
|
| 196 |
generate_image_handler,
|
|
|
|
|
|
|
| 197 |
inputs=[ms, negative_prompt, fine_edge, fix_perspective, grow_size, edge_strength, color_strength, local_strength, seed, steps, cfg],
|
| 198 |
outputs=ms
|
| 199 |
)
|
|
|
|
| 408 |
|
| 409 |
|
| 410 |
if __name__ == "__main__":
|
| 411 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|