Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,6 @@ pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8
|
|
| 43 |
pipe.fuse_lora(lora_scale=0.125)
|
| 44 |
pipe.to(device="cuda", dtype=torch.bfloat16)
|
| 45 |
|
| 46 |
-
# Custom CSS
|
| 47 |
css = """
|
| 48 |
footer {display: none !important}
|
| 49 |
.gradio-container {max-width: 1200px; margin: auto;}
|
|
@@ -66,6 +65,7 @@ footer {display: none !important}
|
|
| 66 |
-webkit-background-clip: text;
|
| 67 |
-webkit-text-fill-color: transparent;
|
| 68 |
}
|
|
|
|
| 69 |
.gallery-container {
|
| 70 |
display: grid;
|
| 71 |
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
@@ -74,6 +74,7 @@ footer {display: none !important}
|
|
| 74 |
background: rgba(255, 255, 255, 0.05);
|
| 75 |
border-radius: 8px;
|
| 76 |
margin-top: 10px;
|
|
|
|
| 77 |
}
|
| 78 |
.gallery-image {
|
| 79 |
width: 100%;
|
|
@@ -85,6 +86,10 @@ footer {display: none !important}
|
|
| 85 |
.gallery-image:hover {
|
| 86 |
transform: scale(1.05);
|
| 87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
"""
|
| 89 |
|
| 90 |
def save_image(image):
|
|
@@ -111,7 +116,8 @@ def load_gallery():
|
|
| 111 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
| 112 |
gr.HTML('<div class="title">AI Image Generator</div>')
|
| 113 |
gr.HTML('<div style="text-align: center; margin-bottom: 2em; color: #666;">Create stunning images from your descriptions</div>')
|
| 114 |
-
|
|
|
|
| 115 |
with gr.Row():
|
| 116 |
with gr.Column(scale=3):
|
| 117 |
prompt = gr.Textbox(
|
|
@@ -194,12 +200,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 194 |
</div>
|
| 195 |
</div>
|
| 196 |
""")
|
| 197 |
-
|
| 198 |
-
with gr.Column(scale=4):
|
| 199 |
-
# Current generated image
|
| 200 |
-
output = gr.Image(label="Generated Image")
|
| 201 |
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
gallery = gr.Gallery(
|
| 204 |
label="Generated Images Gallery",
|
| 205 |
show_label=True,
|
|
@@ -207,8 +213,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 207 |
columns=[4],
|
| 208 |
rows=[2],
|
| 209 |
height="auto",
|
| 210 |
-
object_fit="contain"
|
| 211 |
-
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
# Load existing gallery images on startup
|
| 214 |
gallery.value = load_gallery()
|
|
|
|
| 43 |
pipe.fuse_lora(lora_scale=0.125)
|
| 44 |
pipe.to(device="cuda", dtype=torch.bfloat16)
|
| 45 |
|
|
|
|
| 46 |
css = """
|
| 47 |
footer {display: none !important}
|
| 48 |
.gradio-container {max-width: 1200px; margin: auto;}
|
|
|
|
| 65 |
-webkit-background-clip: text;
|
| 66 |
-webkit-text-fill-color: transparent;
|
| 67 |
}
|
| 68 |
+
/* 갤러리 컨테이너 CSS 수정 */
|
| 69 |
.gallery-container {
|
| 70 |
display: grid;
|
| 71 |
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
|
|
| 74 |
background: rgba(255, 255, 255, 0.05);
|
| 75 |
border-radius: 8px;
|
| 76 |
margin-top: 10px;
|
| 77 |
+
width: 100%;
|
| 78 |
}
|
| 79 |
.gallery-image {
|
| 80 |
width: 100%;
|
|
|
|
| 86 |
.gallery-image:hover {
|
| 87 |
transform: scale(1.05);
|
| 88 |
}
|
| 89 |
+
/* 갤러리와 출력 이미지 컨테이너 너비 통일 */
|
| 90 |
+
.output-image, #gallery {
|
| 91 |
+
width: 100% !important;
|
| 92 |
+
}
|
| 93 |
"""
|
| 94 |
|
| 95 |
def save_image(image):
|
|
|
|
| 116 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
| 117 |
gr.HTML('<div class="title">AI Image Generator</div>')
|
| 118 |
gr.HTML('<div style="text-align: center; margin-bottom: 2em; color: #666;">Create stunning images from your descriptions</div>')
|
| 119 |
+
|
| 120 |
+
|
| 121 |
with gr.Row():
|
| 122 |
with gr.Column(scale=3):
|
| 123 |
prompt = gr.Textbox(
|
|
|
|
| 200 |
</div>
|
| 201 |
</div>
|
| 202 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
+
with gr.Column(scale=4):
|
| 205 |
+
# Current generated image
|
| 206 |
+
output = gr.Image(label="Generated Image", elem_id="output-image", elem_classes=["output-image"])
|
| 207 |
+
|
| 208 |
+
# Gallery of generated images
|
| 209 |
gallery = gr.Gallery(
|
| 210 |
label="Generated Images Gallery",
|
| 211 |
show_label=True,
|
|
|
|
| 213 |
columns=[4],
|
| 214 |
rows=[2],
|
| 215 |
height="auto",
|
| 216 |
+
object_fit="contain",
|
| 217 |
+
elem_classes=["gallery-container"]
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
|
| 221 |
|
| 222 |
# Load existing gallery images on startup
|
| 223 |
gallery.value = load_gallery()
|