Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -45,8 +45,15 @@ pipe.to(device="cuda", dtype=torch.bfloat16)
|
|
45 |
|
46 |
css = """
|
47 |
footer {display: none !important}
|
48 |
-
.gradio-container {
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
.generate-btn {
|
51 |
background: linear-gradient(90deg, #4B79A1 0%, #283E51 100%) !important;
|
52 |
border: none !important;
|
@@ -65,48 +72,74 @@ footer {display: none !important}
|
|
65 |
-webkit-background-clip: text;
|
66 |
-webkit-text-fill-color: transparent;
|
67 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
.gallery-container {
|
69 |
-
display: grid;
|
70 |
-
grid-template-columns: repeat(auto-fill, minmax(
|
71 |
-
gap:
|
72 |
-
padding:
|
73 |
background: rgba(255, 255, 255, 0.05);
|
74 |
border-radius: 8px;
|
75 |
margin-top: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
-
.gallery-
|
78 |
-
width: 100
|
79 |
-
|
80 |
-
object-fit: cover;
|
81 |
border-radius: 4px;
|
82 |
transition: transform 0.2s;
|
83 |
}
|
84 |
-
.gallery-
|
85 |
transform: scale(1.05);
|
86 |
}
|
87 |
-
/*
|
88 |
-
.output-image
|
89 |
width: 100% !important;
|
|
|
90 |
}
|
91 |
-
|
|
|
92 |
width: 100% !important;
|
93 |
max-width: 100% !important;
|
94 |
}
|
95 |
-
|
96 |
-
.gallery-item {
|
97 |
width: 100% !important;
|
98 |
max-width: 100% !important;
|
99 |
}
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
width: 100% !important;
|
|
|
102 |
}
|
103 |
-
|
104 |
-
.fixed-width {
|
105 |
width: 100% !important;
|
106 |
-
max-width:
|
107 |
}
|
108 |
"""
|
109 |
|
|
|
110 |
def save_image(image):
|
111 |
"""Save the generated image and return the path"""
|
112 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
@@ -223,8 +256,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
223 |
elem_id="output-image",
|
224 |
elem_classes=["output-image", "fixed-width"]
|
225 |
)
|
|
|
226 |
|
227 |
-
# Gallery of generated images
|
228 |
gallery = gr.Gallery(
|
229 |
label="Generated Images Gallery",
|
230 |
show_label=True,
|
@@ -232,9 +265,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
232 |
columns=[4],
|
233 |
rows=[2],
|
234 |
height="auto",
|
235 |
-
object_fit="
|
236 |
elem_classes=["gallery-container", "fixed-width"]
|
237 |
)
|
|
|
|
|
238 |
|
239 |
|
240 |
# Load existing gallery images on startup
|
|
|
45 |
|
46 |
css = """
|
47 |
footer {display: none !important}
|
48 |
+
.gradio-container {
|
49 |
+
max-width: 1200px;
|
50 |
+
margin: auto;
|
51 |
+
}
|
52 |
+
.contain {
|
53 |
+
background: rgba(255, 255, 255, 0.05);
|
54 |
+
border-radius: 12px;
|
55 |
+
padding: 20px;
|
56 |
+
}
|
57 |
.generate-btn {
|
58 |
background: linear-gradient(90deg, #4B79A1 0%, #283E51 100%) !important;
|
59 |
border: none !important;
|
|
|
72 |
-webkit-background-clip: text;
|
73 |
-webkit-text-fill-color: transparent;
|
74 |
}
|
75 |
+
/* Gallery specific styles */
|
76 |
+
#gallery {
|
77 |
+
width: 100% !important;
|
78 |
+
max-width: 100% !important;
|
79 |
+
overflow: hidden !important;
|
80 |
+
}
|
81 |
.gallery-container {
|
82 |
+
display: grid !important;
|
83 |
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
|
84 |
+
gap: 16px !important;
|
85 |
+
padding: 16px !important;
|
86 |
background: rgba(255, 255, 255, 0.05);
|
87 |
border-radius: 8px;
|
88 |
margin-top: 10px;
|
89 |
+
width: 100% !important;
|
90 |
+
max-width: 100% !important;
|
91 |
+
box-sizing: border-box !important;
|
92 |
+
}
|
93 |
+
/* Force gallery items to maintain aspect ratio */
|
94 |
+
.gallery-item {
|
95 |
+
width: 100% !important;
|
96 |
+
aspect-ratio: 1 !important;
|
97 |
+
overflow: hidden !important;
|
98 |
}
|
99 |
+
.gallery-item img {
|
100 |
+
width: 100% !important;
|
101 |
+
height: 100% !important;
|
102 |
+
object-fit: cover !important;
|
103 |
border-radius: 4px;
|
104 |
transition: transform 0.2s;
|
105 |
}
|
106 |
+
.gallery-item img:hover {
|
107 |
transform: scale(1.05);
|
108 |
}
|
109 |
+
/* Force output image container to full width */
|
110 |
+
.output-image {
|
111 |
width: 100% !important;
|
112 |
+
max-width: 100% !important;
|
113 |
}
|
114 |
+
/* Force container widths */
|
115 |
+
.contain > div {
|
116 |
width: 100% !important;
|
117 |
max-width: 100% !important;
|
118 |
}
|
119 |
+
.fixed-width {
|
|
|
120 |
width: 100% !important;
|
121 |
max-width: 100% !important;
|
122 |
}
|
123 |
+
/* Remove any horizontal scrolling */
|
124 |
+
.gallery-container::-webkit-scrollbar {
|
125 |
+
display: none !important;
|
126 |
+
}
|
127 |
+
.gallery-container {
|
128 |
+
-ms-overflow-style: none !important;
|
129 |
+
scrollbar-width: none !important;
|
130 |
+
}
|
131 |
+
/* Ensure consistent sizing for gallery wrapper */
|
132 |
+
#gallery > div {
|
133 |
width: 100% !important;
|
134 |
+
max-width: 100% !important;
|
135 |
}
|
136 |
+
#gallery > div > div {
|
|
|
137 |
width: 100% !important;
|
138 |
+
max-width: 100% !important;
|
139 |
}
|
140 |
"""
|
141 |
|
142 |
+
|
143 |
def save_image(image):
|
144 |
"""Save the generated image and return the path"""
|
145 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
256 |
elem_id="output-image",
|
257 |
elem_classes=["output-image", "fixed-width"]
|
258 |
)
|
259 |
+
|
260 |
|
|
|
261 |
gallery = gr.Gallery(
|
262 |
label="Generated Images Gallery",
|
263 |
show_label=True,
|
|
|
265 |
columns=[4],
|
266 |
rows=[2],
|
267 |
height="auto",
|
268 |
+
object_fit="cover",
|
269 |
elem_classes=["gallery-container", "fixed-width"]
|
270 |
)
|
271 |
+
|
272 |
+
|
273 |
|
274 |
|
275 |
# Load existing gallery images on startup
|