Spaces:
Running
on
Zero
Running
on
Zero
🎨 Redesign from AnyCoder
Browse filesThis Pull Request contains a redesigned version of the app with:
- ✨ Modern, mobile-friendly design
- 🎯 Minimal, clean components
- 📱 Responsive layout
- 🚀 Improved user experience
Generated by [AnyCoder](https://huggingface.co/spaces/akhaliq/anycoder)
app.py
CHANGED
|
@@ -11,10 +11,7 @@ pipe = OvisImagePipeline.from_pretrained(
|
|
| 11 |
pipe.to("cuda")
|
| 12 |
|
| 13 |
@spaces.GPU(duration=120)
|
| 14 |
-
def generate_image(
|
| 15 |
-
prompt: str,
|
| 16 |
-
progress=gr.Progress(track_tqdm=True)
|
| 17 |
-
):
|
| 18 |
if not prompt.strip():
|
| 19 |
raise gr.Error("Please enter a prompt to generate an image.")
|
| 20 |
|
|
@@ -27,266 +24,382 @@ def generate_image(
|
|
| 27 |
|
| 28 |
return image
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
* {
|
| 35 |
-
font-family: -apple-system, BlinkMacSystemFont,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
-
/* Light mode styles */
|
| 39 |
.gradio-container {
|
| 40 |
-
max-width:
|
| 41 |
margin: 0 auto !important;
|
| 42 |
-
padding: 0
|
| 43 |
}
|
| 44 |
|
| 45 |
-
/*
|
| 46 |
-
.
|
| 47 |
text-align: center;
|
| 48 |
-
padding:
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
-
.
|
| 52 |
-
font-size:
|
| 53 |
-
font-weight:
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
background: linear-gradient(135deg, #1d1d1f 0%, #424245 100%);
|
| 57 |
-webkit-background-clip: text;
|
| 58 |
-webkit-text-fill-color: transparent;
|
| 59 |
background-clip: text;
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
-
.
|
| 63 |
-
font-size:
|
|
|
|
| 64 |
font-weight: 400;
|
| 65 |
margin: 0;
|
| 66 |
-
|
| 67 |
}
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
background: linear-gradient(135deg, #f5f5f7 0%, #a1a1a6 100%);
|
| 72 |
-
-webkit-background-clip: text;
|
| 73 |
-
-webkit-text-fill-color: transparent;
|
| 74 |
-
background-clip: text;
|
| 75 |
}
|
| 76 |
|
| 77 |
-
/* Card
|
| 78 |
-
.card
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
-
|
| 85 |
-
|
| 86 |
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
|
| 87 |
}
|
| 88 |
|
| 89 |
-
.dark .card
|
| 90 |
-
background:
|
| 91 |
-
border:
|
| 92 |
-
box-shadow: 0
|
| 93 |
}
|
| 94 |
|
| 95 |
-
/*
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
border: none !important;
|
| 99 |
-
border-radius: 12px !important;
|
| 100 |
-
padding: 16px !important;
|
| 101 |
-
font-size: 16px !important;
|
| 102 |
-
line-height: 1.5 !important;
|
| 103 |
-
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 104 |
-
resize: none !important;
|
| 105 |
}
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
outline: none !important;
|
| 111 |
}
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
| 116 |
|
| 117 |
.dark textarea {
|
| 118 |
-
background:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
.dark textarea:focus {
|
| 122 |
-
background:
|
|
|
|
| 123 |
}
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
font-weight: 500 !important;
|
| 129 |
-
letter-spacing: -0.01em !important;
|
| 130 |
}
|
| 131 |
|
| 132 |
-
/* Button
|
| 133 |
button.primary {
|
| 134 |
-
|
|
|
|
| 135 |
color: white !important;
|
| 136 |
border: none !important;
|
| 137 |
-
border-radius:
|
| 138 |
-
padding:
|
| 139 |
-
font-size:
|
| 140 |
-
font-weight:
|
| 141 |
-
letter-spacing: -0.01em !important;
|
| 142 |
cursor: pointer !important;
|
| 143 |
-
transition: all 0.2s
|
| 144 |
-
box-shadow: 0
|
| 145 |
-
min-height:
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
-
button.primary:hover {
|
| 149 |
-
transform:
|
| 150 |
-
box-shadow: 0
|
| 151 |
}
|
| 152 |
|
| 153 |
-
button.primary:active {
|
| 154 |
-
transform:
|
| 155 |
}
|
| 156 |
|
| 157 |
-
|
| 158 |
-
.
|
| 159 |
-
|
| 160 |
-
overflow: hidden;
|
| 161 |
-
background: rgba(142, 142, 147, 0.08);
|
| 162 |
-
min-height: 300px;
|
| 163 |
}
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
-
/*
|
| 170 |
-
.output-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
-
/* Footer
|
| 175 |
-
.footer
|
| 176 |
text-align: center;
|
| 177 |
-
padding:
|
| 178 |
-
font-size: 13px;
|
| 179 |
}
|
| 180 |
|
| 181 |
-
.footer
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
| 183 |
text-decoration: none;
|
|
|
|
| 184 |
font-weight: 500;
|
| 185 |
-
transition: opacity 0.2s;
|
|
|
|
|
|
|
|
|
|
| 186 |
}
|
| 187 |
|
| 188 |
-
.footer
|
| 189 |
-
|
| 190 |
}
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
border: none !important;
|
| 197 |
box-shadow: none !important;
|
|
|
|
| 198 |
}
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
background: linear-gradient(90deg, #0a84ff, #5ac8fa) !important;
|
| 203 |
-
border-radius: 4px !important;
|
| 204 |
}
|
| 205 |
|
| 206 |
-
/* Mobile
|
| 207 |
@media (max-width: 640px) {
|
| 208 |
.gradio-container {
|
| 209 |
-
padding: 0
|
| 210 |
-
}
|
| 211 |
-
|
| 212 |
-
.main-header {
|
| 213 |
-
padding: 32px 16px 24px;
|
| 214 |
}
|
| 215 |
|
| 216 |
-
.
|
| 217 |
-
|
|
|
|
| 218 |
}
|
| 219 |
|
| 220 |
-
.main-
|
| 221 |
-
|
|
|
|
| 222 |
}
|
| 223 |
|
| 224 |
-
.card
|
| 225 |
padding: 20px;
|
| 226 |
-
border-radius:
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
button.primary {
|
| 230 |
-
width: 100% !important;
|
| 231 |
-
padding: 16px 24px !important;
|
| 232 |
}
|
| 233 |
|
| 234 |
textarea {
|
| 235 |
font-size: 16px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
}
|
| 237 |
}
|
| 238 |
|
| 239 |
-
/* Smooth transitions
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
.gradio-container,
|
| 241 |
-
.card
|
|
|
|
| 242 |
textarea,
|
| 243 |
button {
|
| 244 |
-
transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
}
|
| 246 |
"""
|
| 247 |
|
| 248 |
-
|
|
|
|
| 249 |
|
| 250 |
-
#
|
| 251 |
gr.HTML("""
|
| 252 |
-
<div class="
|
| 253 |
-
<h1>OVIS Image</h1>
|
| 254 |
-
<p>Transform your
|
| 255 |
</div>
|
| 256 |
""")
|
| 257 |
|
| 258 |
-
# Input
|
| 259 |
-
with gr.Column(elem_classes="card
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
|
|
|
| 267 |
|
| 268 |
generate_btn = gr.Button(
|
| 269 |
-
"Generate",
|
| 270 |
variant="primary",
|
| 271 |
size="lg"
|
| 272 |
)
|
| 273 |
|
| 274 |
-
# Output
|
| 275 |
-
with gr.Column(elem_classes="
|
| 276 |
output_image = gr.Image(
|
| 277 |
label="Generated Image",
|
| 278 |
type="pil",
|
| 279 |
-
show_label=False
|
|
|
|
|
|
|
|
|
|
| 280 |
)
|
| 281 |
|
| 282 |
# Footer
|
| 283 |
gr.HTML("""
|
| 284 |
-
<div class="footer
|
| 285 |
-
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">
|
|
|
|
|
|
|
| 286 |
</div>
|
| 287 |
""")
|
| 288 |
|
| 289 |
-
#
|
| 290 |
generate_btn.click(
|
| 291 |
fn=generate_image,
|
| 292 |
inputs=[prompt],
|
|
@@ -303,7 +416,16 @@ with gr.Blocks(title="OVIS Image Generator") as demo:
|
|
| 303 |
|
| 304 |
if __name__ == "__main__":
|
| 305 |
demo.launch(
|
| 306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
footer_links=[
|
| 308 |
{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}
|
| 309 |
]
|
|
|
|
| 11 |
pipe.to("cuda")
|
| 12 |
|
| 13 |
@spaces.GPU(duration=120)
|
| 14 |
+
def generate_image(prompt: str, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
| 15 |
if not prompt.strip():
|
| 16 |
raise gr.Error("Please enter a prompt to generate an image.")
|
| 17 |
|
|
|
|
| 24 |
|
| 25 |
return image
|
| 26 |
|
| 27 |
+
# Modern minimal CSS with mobile-first approach
|
| 28 |
+
modern_css = """
|
| 29 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 30 |
+
|
| 31 |
+
:root {
|
| 32 |
+
--primary: #6366f1;
|
| 33 |
+
--primary-hover: #4f46e5;
|
| 34 |
+
--bg-light: #ffffff;
|
| 35 |
+
--bg-dark: #0f172a;
|
| 36 |
+
--text-light: #1e293b;
|
| 37 |
+
--text-dark: #f1f5f9;
|
| 38 |
+
--border-light: #e2e8f0;
|
| 39 |
+
--border-dark: #334155;
|
| 40 |
+
--card-light: #ffffff;
|
| 41 |
+
--card-dark: #1e293b;
|
| 42 |
+
}
|
| 43 |
|
| 44 |
* {
|
| 45 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
body {
|
| 49 |
+
background: var(--bg-light);
|
| 50 |
+
transition: background 0.3s ease;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.dark body {
|
| 54 |
+
background: var(--bg-dark);
|
| 55 |
}
|
| 56 |
|
|
|
|
| 57 |
.gradio-container {
|
| 58 |
+
max-width: 680px !important;
|
| 59 |
margin: 0 auto !important;
|
| 60 |
+
padding: 0 20px 40px !important;
|
| 61 |
}
|
| 62 |
|
| 63 |
+
/* Hero Section */
|
| 64 |
+
.hero {
|
| 65 |
text-align: center;
|
| 66 |
+
padding: 48px 0 40px;
|
| 67 |
+
margin-bottom: 32px;
|
| 68 |
}
|
| 69 |
|
| 70 |
+
.hero-title {
|
| 71 |
+
font-size: clamp(32px, 5vw, 48px);
|
| 72 |
+
font-weight: 700;
|
| 73 |
+
margin: 0 0 12px 0;
|
| 74 |
+
background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
|
|
|
|
| 75 |
-webkit-background-clip: text;
|
| 76 |
-webkit-text-fill-color: transparent;
|
| 77 |
background-clip: text;
|
| 78 |
+
letter-spacing: -0.02em;
|
| 79 |
}
|
| 80 |
|
| 81 |
+
.hero-subtitle {
|
| 82 |
+
font-size: clamp(16px, 2.5vw, 20px);
|
| 83 |
+
color: #64748b;
|
| 84 |
font-weight: 400;
|
| 85 |
margin: 0;
|
| 86 |
+
line-height: 1.6;
|
| 87 |
}
|
| 88 |
|
| 89 |
+
.dark .hero-subtitle {
|
| 90 |
+
color: #94a3b8;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
}
|
| 92 |
|
| 93 |
+
/* Main Card */
|
| 94 |
+
.main-card {
|
| 95 |
+
background: var(--card-light);
|
| 96 |
+
border-radius: 24px;
|
| 97 |
+
padding: 32px;
|
| 98 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 20px 40px rgba(0, 0, 0, 0.03);
|
| 99 |
+
border: 1px solid var(--border-light);
|
| 100 |
+
margin-bottom: 24px;
|
| 101 |
+
transition: all 0.3s ease;
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
+
.dark .main-card {
|
| 105 |
+
background: var(--card-dark);
|
| 106 |
+
border-color: var(--border-dark);
|
| 107 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 20px 40px rgba(0, 0, 0, 0.2);
|
| 108 |
}
|
| 109 |
|
| 110 |
+
/* Input Section */
|
| 111 |
+
.input-section {
|
| 112 |
+
margin-bottom: 24px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
+
label {
|
| 116 |
+
display: block;
|
| 117 |
+
margin-bottom: 12px;
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
+
label span {
|
| 121 |
+
font-size: 14px !important;
|
| 122 |
+
font-weight: 600 !important;
|
| 123 |
+
color: var(--text-light) !important;
|
| 124 |
+
letter-spacing: -0.01em !important;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.dark label span {
|
| 128 |
+
color: var(--text-dark) !important;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
textarea {
|
| 132 |
+
width: 100% !important;
|
| 133 |
+
background: #f8fafc !important;
|
| 134 |
+
border: 2px solid transparent !important;
|
| 135 |
+
border-radius: 16px !important;
|
| 136 |
+
padding: 16px 18px !important;
|
| 137 |
+
font-size: 15px !important;
|
| 138 |
+
line-height: 1.6 !important;
|
| 139 |
+
color: var(--text-light) !important;
|
| 140 |
+
transition: all 0.2s ease !important;
|
| 141 |
+
resize: none !important;
|
| 142 |
+
box-sizing: border-box !important;
|
| 143 |
}
|
| 144 |
|
| 145 |
.dark textarea {
|
| 146 |
+
background: #0f172a !important;
|
| 147 |
+
color: var(--text-dark) !important;
|
| 148 |
+
border-color: transparent !important;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
textarea:focus {
|
| 152 |
+
background: #ffffff !important;
|
| 153 |
+
border-color: var(--primary) !important;
|
| 154 |
+
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
|
| 155 |
+
outline: none !important;
|
| 156 |
}
|
| 157 |
|
| 158 |
.dark textarea:focus {
|
| 159 |
+
background: #1e293b !important;
|
| 160 |
+
border-color: var(--primary) !important;
|
| 161 |
}
|
| 162 |
|
| 163 |
+
textarea::placeholder {
|
| 164 |
+
color: #94a3b8 !important;
|
| 165 |
+
opacity: 1 !important;
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
+
/* Button */
|
| 169 |
button.primary {
|
| 170 |
+
width: 100% !important;
|
| 171 |
+
background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%) !important;
|
| 172 |
color: white !important;
|
| 173 |
border: none !important;
|
| 174 |
+
border-radius: 12px !important;
|
| 175 |
+
padding: 16px 24px !important;
|
| 176 |
+
font-size: 16px !important;
|
| 177 |
+
font-weight: 600 !important;
|
|
|
|
| 178 |
cursor: pointer !important;
|
| 179 |
+
transition: all 0.2s ease !important;
|
| 180 |
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
|
| 181 |
+
min-height: 52px !important;
|
| 182 |
+
letter-spacing: -0.01em !important;
|
| 183 |
}
|
| 184 |
|
| 185 |
+
button.primary:hover:not(:disabled) {
|
| 186 |
+
transform: translateY(-1px) !important;
|
| 187 |
+
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35) !important;
|
| 188 |
}
|
| 189 |
|
| 190 |
+
button.primary:active:not(:disabled) {
|
| 191 |
+
transform: translateY(0) !important;
|
| 192 |
}
|
| 193 |
|
| 194 |
+
button.primary:disabled {
|
| 195 |
+
opacity: 0.6 !important;
|
| 196 |
+
cursor: not-allowed !important;
|
|
|
|
|
|
|
|
|
|
| 197 |
}
|
| 198 |
|
| 199 |
+
/* Output Image */
|
| 200 |
+
.output-card {
|
| 201 |
+
background: var(--card-light);
|
| 202 |
+
border-radius: 24px;
|
| 203 |
+
padding: 24px;
|
| 204 |
+
border: 1px solid var(--border-light);
|
| 205 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 20px 40px rgba(0, 0, 0, 0.03);
|
| 206 |
+
margin-bottom: 24px;
|
| 207 |
+
min-height: 400px;
|
| 208 |
+
display: flex;
|
| 209 |
+
align-items: center;
|
| 210 |
+
justify-content: center;
|
| 211 |
+
transition: all 0.3s ease;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.dark .output-card {
|
| 215 |
+
background: var(--card-dark);
|
| 216 |
+
border-color: var(--border-dark);
|
| 217 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 20px 40px rgba(0, 0, 0, 0.2);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.output-card img {
|
| 221 |
+
border-radius: 16px !important;
|
| 222 |
+
max-width: 100% !important;
|
| 223 |
+
height: auto !important;
|
| 224 |
+
display: block !important;
|
| 225 |
}
|
| 226 |
|
| 227 |
+
/* Empty state */
|
| 228 |
+
.output-card:empty::before {
|
| 229 |
+
content: 'Your generated image will appear here';
|
| 230 |
+
color: #94a3b8;
|
| 231 |
+
font-size: 15px;
|
| 232 |
+
font-weight: 500;
|
| 233 |
}
|
| 234 |
|
| 235 |
+
/* Footer */
|
| 236 |
+
.footer {
|
| 237 |
text-align: center;
|
| 238 |
+
padding: 32px 0 0;
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
+
.footer a {
|
| 242 |
+
display: inline-flex;
|
| 243 |
+
align-items: center;
|
| 244 |
+
gap: 8px;
|
| 245 |
+
color: var(--primary);
|
| 246 |
text-decoration: none;
|
| 247 |
+
font-size: 14px;
|
| 248 |
font-weight: 500;
|
| 249 |
+
transition: opacity 0.2s ease;
|
| 250 |
+
padding: 8px 16px;
|
| 251 |
+
border-radius: 8px;
|
| 252 |
+
background: rgba(99, 102, 241, 0.05);
|
| 253 |
}
|
| 254 |
|
| 255 |
+
.dark .footer a {
|
| 256 |
+
background: rgba(99, 102, 241, 0.1);
|
| 257 |
}
|
| 258 |
|
| 259 |
+
.footer a:hover {
|
| 260 |
+
opacity: 0.8;
|
| 261 |
+
background: rgba(99, 102, 241, 0.1);
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.dark .footer a:hover {
|
| 265 |
+
background: rgba(99, 102, 241, 0.15);
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
/* Progress bar */
|
| 269 |
+
.progress-bar-wrap {
|
| 270 |
+
border-radius: 8px !important;
|
| 271 |
+
overflow: hidden !important;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
.progress-bar {
|
| 275 |
+
background: linear-gradient(90deg, var(--primary), #8b5cf6) !important;
|
| 276 |
+
border-radius: 8px !important;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/* Remove default Gradio padding */
|
| 280 |
+
.block {
|
| 281 |
border: none !important;
|
| 282 |
box-shadow: none !important;
|
| 283 |
+
background: transparent !important;
|
| 284 |
}
|
| 285 |
|
| 286 |
+
.block.padded {
|
| 287 |
+
padding: 0 !important;
|
|
|
|
|
|
|
| 288 |
}
|
| 289 |
|
| 290 |
+
/* Mobile optimizations */
|
| 291 |
@media (max-width: 640px) {
|
| 292 |
.gradio-container {
|
| 293 |
+
padding: 0 16px 32px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
}
|
| 295 |
|
| 296 |
+
.hero {
|
| 297 |
+
padding: 32px 0 32px;
|
| 298 |
+
margin-bottom: 24px;
|
| 299 |
}
|
| 300 |
|
| 301 |
+
.main-card {
|
| 302 |
+
padding: 24px 20px;
|
| 303 |
+
border-radius: 20px;
|
| 304 |
}
|
| 305 |
|
| 306 |
+
.output-card {
|
| 307 |
padding: 20px;
|
| 308 |
+
border-radius: 20px;
|
| 309 |
+
min-height: 320px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
}
|
| 311 |
|
| 312 |
textarea {
|
| 313 |
font-size: 16px !important;
|
| 314 |
+
padding: 14px 16px !important;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
button.primary {
|
| 318 |
+
padding: 14px 20px !important;
|
| 319 |
+
font-size: 15px !important;
|
| 320 |
}
|
| 321 |
}
|
| 322 |
|
| 323 |
+
/* Smooth transitions */
|
| 324 |
+
* {
|
| 325 |
+
-webkit-tap-highlight-color: transparent;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
.gradio-container,
|
| 329 |
+
.main-card,
|
| 330 |
+
.output-card,
|
| 331 |
textarea,
|
| 332 |
button {
|
| 333 |
+
transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease !important;
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
/* Loading state */
|
| 337 |
+
@keyframes pulse {
|
| 338 |
+
0%, 100% { opacity: 1; }
|
| 339 |
+
50% { opacity: 0.5; }
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
.generating {
|
| 343 |
+
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
/* Accessibility */
|
| 347 |
+
button:focus-visible,
|
| 348 |
+
textarea:focus-visible {
|
| 349 |
+
outline: 2px solid var(--primary) !important;
|
| 350 |
+
outline-offset: 2px !important;
|
| 351 |
}
|
| 352 |
"""
|
| 353 |
|
| 354 |
+
# Create the Gradio interface
|
| 355 |
+
with gr.Blocks() as demo:
|
| 356 |
|
| 357 |
+
# Hero Section
|
| 358 |
gr.HTML("""
|
| 359 |
+
<div class="hero">
|
| 360 |
+
<h1 class="hero-title">OVIS Image Generator</h1>
|
| 361 |
+
<p class="hero-subtitle">Transform your imagination into stunning visuals with AI</p>
|
| 362 |
</div>
|
| 363 |
""")
|
| 364 |
|
| 365 |
+
# Main Input Card
|
| 366 |
+
with gr.Column(elem_classes="main-card"):
|
| 367 |
+
with gr.Column(elem_classes="input-section"):
|
| 368 |
+
prompt = gr.Textbox(
|
| 369 |
+
label="What would you like to create?",
|
| 370 |
+
placeholder="A mystical forest with glowing mushrooms under moonlight, digital art style...",
|
| 371 |
+
lines=4,
|
| 372 |
+
max_lines=8,
|
| 373 |
+
show_label=True
|
| 374 |
+
)
|
| 375 |
|
| 376 |
generate_btn = gr.Button(
|
| 377 |
+
"Generate Image",
|
| 378 |
variant="primary",
|
| 379 |
size="lg"
|
| 380 |
)
|
| 381 |
|
| 382 |
+
# Output Card
|
| 383 |
+
with gr.Column(elem_classes="output-card"):
|
| 384 |
output_image = gr.Image(
|
| 385 |
label="Generated Image",
|
| 386 |
type="pil",
|
| 387 |
+
show_label=False,
|
| 388 |
+
show_download_button=True,
|
| 389 |
+
show_share_button=True,
|
| 390 |
+
container=False
|
| 391 |
)
|
| 392 |
|
| 393 |
# Footer
|
| 394 |
gr.HTML("""
|
| 395 |
+
<div class="footer">
|
| 396 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">
|
| 397 |
+
✨ Built with anycoder
|
| 398 |
+
</a>
|
| 399 |
</div>
|
| 400 |
""")
|
| 401 |
|
| 402 |
+
# Event handlers
|
| 403 |
generate_btn.click(
|
| 404 |
fn=generate_image,
|
| 405 |
inputs=[prompt],
|
|
|
|
| 416 |
|
| 417 |
if __name__ == "__main__":
|
| 418 |
demo.launch(
|
| 419 |
+
theme=gr.themes.Soft(
|
| 420 |
+
primary_hue="indigo",
|
| 421 |
+
secondary_hue="purple",
|
| 422 |
+
neutral_hue="slate",
|
| 423 |
+
font=gr.themes.GoogleFont("Inter"),
|
| 424 |
+
text_size="md",
|
| 425 |
+
spacing_size="md",
|
| 426 |
+
radius_size="lg"
|
| 427 |
+
),
|
| 428 |
+
css=modern_css,
|
| 429 |
footer_links=[
|
| 430 |
{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}
|
| 431 |
]
|