Spaces:
Building
on
Zero
Building
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -48,108 +48,7 @@ pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8
|
|
48 |
pipe.fuse_lora(lora_scale=0.125)
|
49 |
pipe.to(device="cuda", dtype=torch.bfloat16)
|
50 |
|
51 |
-
|
52 |
-
footer {display: none !important}
|
53 |
-
.gradio-container {
|
54 |
-
max-width: 1200px;
|
55 |
-
margin: auto;
|
56 |
-
}
|
57 |
-
.contain {
|
58 |
-
background: rgba(255, 255, 255, 0.05);
|
59 |
-
border-radius: 12px;
|
60 |
-
padding: 20px;
|
61 |
-
}
|
62 |
-
.generate-btn {
|
63 |
-
background: linear-gradient(90deg, #4B79A1 0%, #283E51 100%) !important;
|
64 |
-
border: none !important;
|
65 |
-
color: white !important;
|
66 |
-
}
|
67 |
-
.generate-btn:hover {
|
68 |
-
transform: translateY(-2px);
|
69 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
70 |
-
}
|
71 |
-
.title {
|
72 |
-
text-align: center;
|
73 |
-
font-size: 2.5em;
|
74 |
-
font-weight: bold;
|
75 |
-
margin-bottom: 1em;
|
76 |
-
background: linear-gradient(90deg, #4B79A1 0%, #283E51 100%);
|
77 |
-
-webkit-background-clip: text;
|
78 |
-
-webkit-text-fill-color: transparent;
|
79 |
-
}
|
80 |
-
/* Gallery specific styles */
|
81 |
-
#gallery {
|
82 |
-
width: 100% !important;
|
83 |
-
max-width: 100% !important;
|
84 |
-
overflow: visible !important;
|
85 |
-
}
|
86 |
-
#gallery > div {
|
87 |
-
width: 100% !important;
|
88 |
-
max-width: none !important;
|
89 |
-
}
|
90 |
-
#gallery > div > div {
|
91 |
-
width: 100% !important;
|
92 |
-
display: grid !important;
|
93 |
-
grid-template-columns: repeat(5, 1fr) !important;
|
94 |
-
gap: 16px !important;
|
95 |
-
padding: 16px !important;
|
96 |
-
}
|
97 |
-
.gallery-container {
|
98 |
-
background: rgba(255, 255, 255, 0.05);
|
99 |
-
border-radius: 8px;
|
100 |
-
margin-top: 10px;
|
101 |
-
width: 100% !important;
|
102 |
-
box-sizing: border-box !important;
|
103 |
-
}
|
104 |
-
/* Force gallery items to maintain aspect ratio */
|
105 |
-
.gallery-item {
|
106 |
-
width: 100% !important;
|
107 |
-
aspect-ratio: 1 !important;
|
108 |
-
overflow: hidden !important;
|
109 |
-
border-radius: 4px !important;
|
110 |
-
}
|
111 |
-
.gallery-item img {
|
112 |
-
width: 100% !important;
|
113 |
-
height: 100% !important;
|
114 |
-
object-fit: cover !important;
|
115 |
-
border-radius: 4px !important;
|
116 |
-
transition: transform 0.2s;
|
117 |
-
}
|
118 |
-
.gallery-item img:hover {
|
119 |
-
transform: scale(1.05);
|
120 |
-
}
|
121 |
-
/* Force output image container to full width */
|
122 |
-
.output-image {
|
123 |
-
width: 100% !important;
|
124 |
-
max-width: 100% !important;
|
125 |
-
}
|
126 |
-
/* Force container widths */
|
127 |
-
.contain > div {
|
128 |
-
width: 100% !important;
|
129 |
-
max-width: 100% !important;
|
130 |
-
}
|
131 |
-
.fixed-width {
|
132 |
-
width: 100% !important;
|
133 |
-
max-width: 100% !important;
|
134 |
-
}
|
135 |
-
/* Remove any horizontal scrolling */
|
136 |
-
.gallery-container::-webkit-scrollbar {
|
137 |
-
display: none !important;
|
138 |
-
}
|
139 |
-
.gallery-container {
|
140 |
-
-ms-overflow-style: none !important;
|
141 |
-
scrollbar-width: none !important;
|
142 |
-
}
|
143 |
-
/* Ensure consistent sizing for gallery wrapper */
|
144 |
-
#gallery > div {
|
145 |
-
width: 100% !important;
|
146 |
-
max-width: 100% !important;
|
147 |
-
}
|
148 |
-
#gallery > div > div {
|
149 |
-
width: 100% !important;
|
150 |
-
max-width: 100% !important;
|
151 |
-
}
|
152 |
-
"""
|
153 |
def save_image(image):
|
154 |
"""Save the generated image and return the path"""
|
155 |
try:
|
@@ -211,9 +110,7 @@ def load_gallery():
|
|
211 |
return []
|
212 |
|
213 |
# Create Gradio interface
|
214 |
-
with gr.Blocks(theme=gr.themes.Soft()
|
215 |
-
gr.HTML('<div class="title">AI Image Generator</div>')
|
216 |
-
gr.HTML('<div style="text-align: center; margin-bottom: 2em; color: #666;">Create stunning images from your descriptions</div>')
|
217 |
|
218 |
with gr.Row():
|
219 |
with gr.Column(scale=3):
|
|
|
48 |
pipe.fuse_lora(lora_scale=0.125)
|
49 |
pipe.to(device="cuda", dtype=torch.bfloat16)
|
50 |
|
51 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
def save_image(image):
|
53 |
"""Save the generated image and return the path"""
|
54 |
try:
|
|
|
110 |
return []
|
111 |
|
112 |
# Create Gradio interface
|
113 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
|
|
114 |
|
115 |
with gr.Row():
|
116 |
with gr.Column(scale=3):
|