Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- app.py +130 -270
- requirements.txt +8 -6
app.py
CHANGED
|
@@ -30,330 +30,186 @@ def generate_image(
|
|
| 30 |
|
| 31 |
return image
|
| 32 |
|
| 33 |
-
# Apple-inspired CSS
|
| 34 |
apple_css = """
|
| 35 |
-
|
| 36 |
-
@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&family=SF+Pro+Text:wght@400;500;600&display=swap');
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
--apple-blue-hover: #0077ED;
|
| 41 |
-
--apple-gray-1: #f5f5f7;
|
| 42 |
-
--apple-gray-2: #e8e8ed;
|
| 43 |
-
--apple-gray-3: #d2d2d7;
|
| 44 |
-
--apple-gray-4: #86868b;
|
| 45 |
-
--apple-gray-5: #1d1d1f;
|
| 46 |
-
--apple-white: #ffffff;
|
| 47 |
-
--apple-black: #000000;
|
| 48 |
-
--apple-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
| 49 |
-
--apple-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.12);
|
| 50 |
-
--apple-radius: 12px;
|
| 51 |
-
--apple-radius-lg: 18px;
|
| 52 |
-
--apple-transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
|
| 53 |
}
|
| 54 |
|
| 55 |
-
/* Base styles */
|
| 56 |
.gradio-container {
|
| 57 |
-
|
| 58 |
-
background: linear-gradient(180deg, var(--apple-gray-1) 0%, var(--apple-white) 100%) !important;
|
| 59 |
-
min-height: 100vh;
|
| 60 |
-
max-width: 1200px !important;
|
| 61 |
margin: 0 auto !important;
|
| 62 |
-
|
| 63 |
}
|
| 64 |
|
| 65 |
-
|
| 66 |
-
.header-container {
|
| 67 |
text-align: center;
|
| 68 |
-
padding:
|
| 69 |
-
margin-bottom: 40px;
|
| 70 |
}
|
| 71 |
|
| 72 |
-
.header
|
| 73 |
-
font-size:
|
| 74 |
-
font-weight: 600
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
line-height: 1.1 !important;
|
| 79 |
}
|
| 80 |
|
| 81 |
-
.header
|
| 82 |
-
font-size:
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
margin: 0 auto !important;
|
| 87 |
-
line-height: 1.5 !important;
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
.header-container a {
|
| 91 |
-
color: var(--apple-blue) !important;
|
| 92 |
-
text-decoration: none !important;
|
| 93 |
-
transition: var(--apple-transition);
|
| 94 |
}
|
| 95 |
|
| 96 |
-
.header
|
| 97 |
-
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
background: var(--apple-white) !important;
|
| 103 |
-
border-radius: var(--apple-radius-lg) !important;
|
| 104 |
-
padding: 32px !important;
|
| 105 |
-
box-shadow: var(--apple-shadow) !important;
|
| 106 |
-
border: 1px solid var(--apple-gray-2) !important;
|
| 107 |
-
transition: var(--apple-transition);
|
| 108 |
}
|
| 109 |
|
| 110 |
-
.
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
transition: var(--apple-transition);
|
| 123 |
-
color: var(--apple-gray-5) !important;
|
| 124 |
}
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
outline: none !important;
|
| 130 |
-
box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15) !important;
|
| 131 |
}
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
font-weight: 600 !important;
|
| 136 |
-
color: var(--apple-gray-5) !important;
|
| 137 |
-
letter-spacing: -0.01em !important;
|
| 138 |
-
margin-bottom: 8px !important;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
/* Slider styling */
|
| 142 |
-
.gradio-slider input[type="range"] {
|
| 143 |
-
height: 6px !important;
|
| 144 |
-
background: var(--apple-gray-2) !important;
|
| 145 |
-
border-radius: 3px !important;
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
.gradio-slider input[type="range"]::-webkit-slider-thumb {
|
| 149 |
-
width: 22px !important;
|
| 150 |
-
height: 22px !important;
|
| 151 |
-
background: var(--apple-white) !important;
|
| 152 |
-
border: 2px solid var(--apple-gray-3) !important;
|
| 153 |
-
border-radius: 50% !important;
|
| 154 |
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
|
| 155 |
-
cursor: pointer !important;
|
| 156 |
-
transition: var(--apple-transition);
|
| 157 |
}
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
.gradio-slider label {
|
| 165 |
-
font-size: 14px !important;
|
| 166 |
-
font-weight: 600 !important;
|
| 167 |
-
color: var(--apple-gray-5) !important;
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
.gradio-slider .wrap {
|
| 171 |
-
background: transparent !important;
|
| 172 |
}
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
font-size: 17px !important;
|
| 178 |
-
font-weight: 500 !important;
|
| 179 |
-
border-radius: 980px !important;
|
| 180 |
-
padding: 16px 32px !important;
|
| 181 |
-
transition: var(--apple-transition);
|
| 182 |
border: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
cursor: pointer !important;
|
| 184 |
-
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
.gradio-button.primary {
|
| 188 |
-
background: var(--apple-blue) !important;
|
| 189 |
-
color: var(--apple-white) !important;
|
| 190 |
}
|
| 191 |
|
| 192 |
-
|
| 193 |
-
background:
|
| 194 |
transform: scale(1.02);
|
| 195 |
}
|
| 196 |
|
| 197 |
-
|
| 198 |
transform: scale(0.98);
|
| 199 |
}
|
| 200 |
|
| 201 |
-
.
|
| 202 |
-
background:
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
.gradio-button.secondary:hover {
|
| 207 |
-
background: var(--apple-gray-2) !important;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
/* Image output styling */
|
| 211 |
-
.gradio-image {
|
| 212 |
-
border-radius: var(--apple-radius-lg) !important;
|
| 213 |
-
overflow: hidden !important;
|
| 214 |
-
background: var(--apple-gray-1) !important;
|
| 215 |
-
border: 1px solid var(--apple-gray-2) !important;
|
| 216 |
-
}
|
| 217 |
-
|
| 218 |
-
.gradio-image img {
|
| 219 |
-
border-radius: var(--apple-radius) !important;
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
/* Row and column spacing */
|
| 223 |
-
.gradio-row {
|
| 224 |
-
gap: 16px !important;
|
| 225 |
-
}
|
| 226 |
-
|
| 227 |
-
.gradio-column {
|
| 228 |
-
gap: 16px !important;
|
| 229 |
}
|
| 230 |
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
font-size: 13px !important;
|
| 234 |
-
font-weight: 600 !important;
|
| 235 |
-
color: var(--apple-gray-4) !important;
|
| 236 |
-
text-transform: uppercase !important;
|
| 237 |
-
letter-spacing: 0.02em !important;
|
| 238 |
-
margin-bottom: 16px !important;
|
| 239 |
}
|
| 240 |
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
margin-top: 8px !important;
|
| 247 |
}
|
| 248 |
|
| 249 |
-
|
| 250 |
-
.built-with {
|
| 251 |
text-align: center;
|
| 252 |
-
padding:
|
| 253 |
-
|
| 254 |
-
|
| 255 |
}
|
| 256 |
|
| 257 |
-
.
|
| 258 |
-
color:
|
| 259 |
-
text-decoration: none
|
| 260 |
}
|
| 261 |
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
/* Progress bar */
|
| 267 |
-
.progress-bar {
|
| 268 |
-
background: var(--apple-gray-2) !important;
|
| 269 |
-
border-radius: 4px !important;
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
.progress-bar > div {
|
| 273 |
-
background: linear-gradient(90deg, var(--apple-blue), #34C759) !important;
|
| 274 |
-
border-radius: 4px !important;
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
/* Placeholder text */
|
| 278 |
-
::placeholder {
|
| 279 |
-
color: var(--apple-gray-4) !important;
|
| 280 |
-
opacity: 1 !important;
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
/* Remove default borders and shadows */
|
| 284 |
-
.block {
|
| 285 |
border: none !important;
|
| 286 |
box-shadow: none !important;
|
| 287 |
}
|
| 288 |
|
| 289 |
-
/* Group styling */
|
| 290 |
-
.group {
|
| 291 |
-
background: var(--apple-white) !important;
|
| 292 |
-
border-radius: var(--apple-radius-lg) !important;
|
| 293 |
-
padding: 24px !important;
|
| 294 |
-
box-shadow: var(--apple-shadow) !important;
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
-
/* Accordion styling */
|
| 298 |
.gradio-accordion {
|
| 299 |
-
border:
|
| 300 |
-
|
| 301 |
-
overflow: hidden !important;
|
| 302 |
-
}
|
| 303 |
-
|
| 304 |
-
.gradio-accordion > button {
|
| 305 |
-
background: var(--apple-gray-1) !important;
|
| 306 |
-
font-weight: 500 !important;
|
| 307 |
}
|
| 308 |
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
|
|
|
| 312 |
}
|
| 313 |
"""
|
| 314 |
|
| 315 |
-
with gr.Blocks(
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
# Header
|
| 319 |
gr.HTML("""
|
| 320 |
-
<div class="header
|
| 321 |
<h1>OVIS Image</h1>
|
| 322 |
-
<p>
|
| 323 |
-
<p style="margin-top: 12px; font-size: 14px;">
|
| 324 |
-
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
|
| 325 |
-
</p>
|
| 326 |
</div>
|
| 327 |
""")
|
| 328 |
|
| 329 |
-
with gr.
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
elem_id="prompt-input"
|
| 339 |
-
)
|
| 340 |
-
|
| 341 |
negative_prompt = gr.Textbox(
|
| 342 |
-
label="Negative
|
| 343 |
-
placeholder="
|
| 344 |
lines=2
|
| 345 |
)
|
| 346 |
|
| 347 |
-
gr.
|
| 348 |
-
|
| 349 |
-
with gr.Group(elem_classes="slider-row"):
|
| 350 |
num_steps = gr.Slider(
|
| 351 |
-
label="
|
| 352 |
minimum=10,
|
| 353 |
maximum=100,
|
| 354 |
value=50,
|
| 355 |
-
step=5
|
| 356 |
-
info="More steps = higher quality, slower generation"
|
| 357 |
)
|
| 358 |
|
| 359 |
cfg_scale = gr.Slider(
|
|
@@ -361,29 +217,33 @@ with gr.Blocks(
|
|
| 361 |
minimum=1.0,
|
| 362 |
maximum=15.0,
|
| 363 |
value=5.0,
|
| 364 |
-
step=0.5
|
| 365 |
-
info="How closely to follow your prompt"
|
| 366 |
)
|
| 367 |
-
|
| 368 |
-
generate_btn = gr.Button(
|
| 369 |
-
"Generate Image",
|
| 370 |
-
variant="primary",
|
| 371 |
-
size="lg",
|
| 372 |
-
elem_id="generate-btn"
|
| 373 |
-
)
|
| 374 |
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
-
#
|
| 387 |
generate_btn.click(
|
| 388 |
fn=generate_image,
|
| 389 |
inputs=[prompt, negative_prompt, num_steps, cfg_scale],
|
|
|
|
| 30 |
|
| 31 |
return image
|
| 32 |
|
| 33 |
+
# Clean Apple-inspired CSS
|
| 34 |
apple_css = """
|
| 35 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
|
|
|
|
| 36 |
|
| 37 |
+
* {
|
| 38 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
|
|
|
| 41 |
.gradio-container {
|
| 42 |
+
max-width: 900px !important;
|
|
|
|
|
|
|
|
|
|
| 43 |
margin: 0 auto !important;
|
| 44 |
+
background: #fbfbfd !important;
|
| 45 |
}
|
| 46 |
|
| 47 |
+
.main-header {
|
|
|
|
| 48 |
text-align: center;
|
| 49 |
+
padding: 48px 24px 32px;
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
+
.main-header h1 {
|
| 53 |
+
font-size: 44px;
|
| 54 |
+
font-weight: 600;
|
| 55 |
+
color: #1d1d1f;
|
| 56 |
+
margin: 0 0 8px 0;
|
| 57 |
+
letter-spacing: -0.03em;
|
|
|
|
| 58 |
}
|
| 59 |
|
| 60 |
+
.main-header p {
|
| 61 |
+
font-size: 17px;
|
| 62 |
+
color: #86868b;
|
| 63 |
+
margin: 0;
|
| 64 |
+
font-weight: 400;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
+
.main-header a {
|
| 68 |
+
color: #0071e3;
|
| 69 |
+
text-decoration: none;
|
| 70 |
}
|
| 71 |
|
| 72 |
+
.main-header a:hover {
|
| 73 |
+
text-decoration: underline;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
}
|
| 75 |
|
| 76 |
+
.card {
|
| 77 |
+
background: #ffffff;
|
| 78 |
+
border-radius: 16px;
|
| 79 |
+
padding: 28px;
|
| 80 |
+
box-shadow: 0 2px 12px rgba(0,0,0,0.04);
|
| 81 |
+
border: 1px solid #e5e5e7;
|
| 82 |
}
|
| 83 |
|
| 84 |
+
textarea, input[type="text"] {
|
| 85 |
+
background: #f5f5f7 !important;
|
| 86 |
+
border: none !important;
|
| 87 |
+
border-radius: 10px !important;
|
| 88 |
+
padding: 14px 16px !important;
|
| 89 |
+
font-size: 15px !important;
|
| 90 |
+
color: #1d1d1f !important;
|
| 91 |
+
transition: all 0.2s ease !important;
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
+
textarea:focus, input[type="text"]:focus {
|
| 95 |
+
background: #ffffff !important;
|
| 96 |
+
box-shadow: 0 0 0 3px rgba(0,113,227,0.2) !important;
|
| 97 |
outline: none !important;
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
+
textarea::placeholder, input::placeholder {
|
| 101 |
+
color: #86868b !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
+
label span {
|
| 105 |
+
font-size: 13px !important;
|
| 106 |
+
font-weight: 500 !important;
|
| 107 |
+
color: #1d1d1f !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
+
button.primary {
|
| 111 |
+
background: #0071e3 !important;
|
| 112 |
+
color: white !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
border: none !important;
|
| 114 |
+
border-radius: 980px !important;
|
| 115 |
+
padding: 12px 28px !important;
|
| 116 |
+
font-size: 15px !important;
|
| 117 |
+
font-weight: 500 !important;
|
| 118 |
cursor: pointer !important;
|
| 119 |
+
transition: all 0.2s ease !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
|
| 122 |
+
button.primary:hover {
|
| 123 |
+
background: #0077ed !important;
|
| 124 |
transform: scale(1.02);
|
| 125 |
}
|
| 126 |
|
| 127 |
+
button.primary:active {
|
| 128 |
transform: scale(0.98);
|
| 129 |
}
|
| 130 |
|
| 131 |
+
.settings-section {
|
| 132 |
+
background: #f5f5f7;
|
| 133 |
+
border-radius: 12px;
|
| 134 |
+
padding: 20px;
|
| 135 |
+
margin-top: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
+
input[type="range"] {
|
| 139 |
+
accent-color: #0071e3 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
}
|
| 141 |
|
| 142 |
+
.output-image {
|
| 143 |
+
border-radius: 12px;
|
| 144 |
+
overflow: hidden;
|
| 145 |
+
background: #f5f5f7;
|
| 146 |
+
min-height: 400px;
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
+
.footer-text {
|
|
|
|
| 150 |
text-align: center;
|
| 151 |
+
padding: 24px;
|
| 152 |
+
font-size: 13px;
|
| 153 |
+
color: #86868b;
|
| 154 |
}
|
| 155 |
|
| 156 |
+
.footer-text a {
|
| 157 |
+
color: #0071e3;
|
| 158 |
+
text-decoration: none;
|
| 159 |
}
|
| 160 |
|
| 161 |
+
/* Hide unnecessary elements */
|
| 162 |
+
.block.padded:not(.gradio-group) {
|
| 163 |
+
padding: 0 !important;
|
| 164 |
+
background: transparent !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
border: none !important;
|
| 166 |
box-shadow: none !important;
|
| 167 |
}
|
| 168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
.gradio-accordion {
|
| 170 |
+
border: none !important;
|
| 171 |
+
background: transparent !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
+
.gradio-accordion > .label-wrap {
|
| 175 |
+
background: #f5f5f7 !important;
|
| 176 |
+
border-radius: 10px !important;
|
| 177 |
+
padding: 12px 16px !important;
|
| 178 |
}
|
| 179 |
"""
|
| 180 |
|
| 181 |
+
with gr.Blocks(title="OVIS Image Generator") as demo:
|
| 182 |
+
|
| 183 |
+
# Clean header
|
|
|
|
| 184 |
gr.HTML("""
|
| 185 |
+
<div class="main-header">
|
| 186 |
<h1>OVIS Image</h1>
|
| 187 |
+
<p>Transform your ideas into images</p>
|
|
|
|
|
|
|
|
|
|
| 188 |
</div>
|
| 189 |
""")
|
| 190 |
|
| 191 |
+
with gr.Column(elem_classes="card"):
|
| 192 |
+
prompt = gr.Textbox(
|
| 193 |
+
label="What do you want to create?",
|
| 194 |
+
placeholder="A serene mountain landscape at sunset...",
|
| 195 |
+
lines=3,
|
| 196 |
+
show_label=True
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
|
|
|
|
|
|
| 200 |
negative_prompt = gr.Textbox(
|
| 201 |
+
label="Negative prompt",
|
| 202 |
+
placeholder="Things to avoid...",
|
| 203 |
lines=2
|
| 204 |
)
|
| 205 |
|
| 206 |
+
with gr.Row():
|
|
|
|
|
|
|
| 207 |
num_steps = gr.Slider(
|
| 208 |
+
label="Steps",
|
| 209 |
minimum=10,
|
| 210 |
maximum=100,
|
| 211 |
value=50,
|
| 212 |
+
step=5
|
|
|
|
| 213 |
)
|
| 214 |
|
| 215 |
cfg_scale = gr.Slider(
|
|
|
|
| 217 |
minimum=1.0,
|
| 218 |
maximum=15.0,
|
| 219 |
value=5.0,
|
| 220 |
+
step=0.5
|
|
|
|
| 221 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
+
generate_btn = gr.Button(
|
| 224 |
+
"Generate",
|
| 225 |
+
variant="primary",
|
| 226 |
+
size="lg"
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
gr.HTML("<div style='height: 16px'></div>")
|
| 230 |
+
|
| 231 |
+
with gr.Column(elem_classes="card"):
|
| 232 |
+
output_image = gr.Image(
|
| 233 |
+
label="",
|
| 234 |
+
type="pil",
|
| 235 |
+
show_label=False,
|
| 236 |
+
elem_classes="output-image"
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
# Footer
|
| 240 |
+
gr.HTML("""
|
| 241 |
+
<div class="footer-text">
|
| 242 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
|
| 243 |
+
</div>
|
| 244 |
+
""")
|
| 245 |
|
| 246 |
+
# Events
|
| 247 |
generate_btn.click(
|
| 248 |
fn=generate_image,
|
| 249 |
inputs=[prompt, negative_prompt, num_steps, cfg_scale],
|
requirements.txt
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
spaces
|
| 2 |
-
|
|
|
|
|
|
|
| 3 |
git+https://github.com/huggingface/transformers
|
| 4 |
sentencepiece
|
| 5 |
accelerate
|
| 6 |
-
torch
|
| 7 |
-
torchvision
|
| 8 |
-
torchaudio
|
| 9 |
tokenizers
|
| 10 |
datasets
|
| 11 |
-
gradio
|
| 12 |
requests
|
| 13 |
-
Pillow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
spaces
|
| 2 |
+
gradio
|
| 3 |
+
git+https://github.com/huggingface/diffusers
|
| 4 |
+
torch
|
| 5 |
git+https://github.com/huggingface/transformers
|
| 6 |
sentencepiece
|
| 7 |
accelerate
|
|
|
|
|
|
|
|
|
|
| 8 |
tokenizers
|
| 9 |
datasets
|
|
|
|
| 10 |
requests
|
| 11 |
+
Pillow
|
| 12 |
+
torchvision
|
| 13 |
+
torchaudio
|
| 14 |
+
opencv-python
|
| 15 |
+
numpy
|