sagar007 commited on
Commit
fe29fc7
·
verified ·
1 Parent(s): f8cf548

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -40
app.py CHANGED
@@ -91,19 +91,23 @@ def inference(text, style, inference_step, guidance_scale, seed, guidance_method
91
  css = """
92
  <style>
93
  body {
94
- background: linear-gradient(135deg, #6e48aa, #9d50bb, #f4d03f);
95
  font-family: 'Arial', sans-serif;
96
- color: #333;
 
 
 
97
  }
98
  #app-header {
99
  text-align: center;
100
- background: rgba(255, 255, 255, 0.9);
101
  padding: 30px;
102
  border-radius: 20px;
103
- box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
104
  position: relative;
105
  overflow: hidden;
106
- margin-bottom: 30px;
 
107
  }
108
  #app-header::before {
109
  content: "";
@@ -112,27 +116,27 @@ css = """
112
  left: -50%;
113
  width: 200%;
114
  height: 200%;
115
- background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
116
- animation: shimmer 10s infinite linear;
117
  }
118
  @keyframes shimmer {
119
  0% { transform: rotate(0deg); }
120
  100% { transform: rotate(360deg); }
121
  }
122
  #app-header h1 {
123
- color: #6e48aa;
124
  font-size: 2.5em;
125
  margin-bottom: 15px;
126
- text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
127
  }
128
  #app-header p {
129
  font-size: 1.2em;
130
- color: #555;
131
  }
132
  .concept-container {
133
  display: flex;
134
  justify-content: center;
135
- gap: 30px;
136
  margin-top: 30px;
137
  flex-wrap: wrap;
138
  }
@@ -141,21 +145,21 @@ css = """
141
  transition: transform 0.3s, box-shadow 0.3s;
142
  border-radius: 15px;
143
  overflow: hidden;
144
- background: white;
145
- box-shadow: 0 5px 15px rgba(0,0,0,0.1);
 
146
  }
147
  .concept:hover {
148
  transform: translateY(-10px) rotate(3deg);
149
- box-shadow: 0 15px 30px rgba(0,0,0,0.2);
150
  }
151
  .concept img {
152
- width: 120px;
153
  height: 120px;
154
  object-fit: cover;
155
- border-radius: 15px 15px 0 0;
156
  }
157
  .concept-description {
158
- background-color: #6e48aa;
159
  color: white;
160
  padding: 10px;
161
  font-size: 0.9em;
@@ -163,9 +167,10 @@ css = """
163
  }
164
  .artifact {
165
  position: absolute;
166
- background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
167
  border-radius: 50%;
168
  opacity: 0.5;
 
169
  }
170
  .artifact.large {
171
  width: 400px;
@@ -194,8 +199,24 @@ css = """
194
  50% { transform: translateY(-20px) rotate(10deg); }
195
  }
196
  @keyframes pulse {
197
- 0% { transform: scale(1); opacity: 0.5; }
198
- 100% { transform: scale(1.1); opacity: 0.8; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
200
  </style>
201
  <div id="app-header">
@@ -206,19 +227,19 @@ css = """
206
  <p>Unleash your imagination with AI-powered generative art</p>
207
  <div class="concept-container">
208
  <div class="concept">
209
- <img src="https://example.com/illustration-style.jpg" alt="Illustration Style">
210
  <div class="concept-description">Illustration Style</div>
211
  </div>
212
  <div class="concept">
213
- <img src="https://example.com/line-art.jpg" alt="Line Art">
214
  <div class="concept-description">Line Art</div>
215
  </div>
216
  <div class="concept">
217
- <img src="https://example.com/midjourney-style.jpg" alt="Midjourney Style">
218
  <div class="concept-description">Midjourney Style</div>
219
  </div>
220
  <div class="concept">
221
- <img src="https://example.com/hanfu-anime-style.jpg" alt="Hanfu Anime">
222
  <div class="concept-description">Hanfu Anime</div>
223
  </div>
224
  </div>
@@ -226,7 +247,7 @@ css = """
226
  """
227
 
228
  with gr.Blocks(css=css) as demo:
229
- gr.HTML("<div class='header'><h1>🌟 Dreamscape Creator</h1></div>")
230
 
231
  with gr.Row():
232
  text = gr.Textbox(label="Prompt", placeholder="Describe your dreamscape...")
@@ -258,18 +279,14 @@ with gr.Blocks(css=css) as demo:
258
  )
259
 
260
  gr.Examples(
261
- examples=[
262
- ["Floating island with waterfalls", 'Illustration Style', 50, 7.5, 42, 'Grayscale', 200, "256x256"],
263
- ["Futuristic city with neon lights", 'Line Art', 30, 8.0, 123, 'Bright', 300, "256x256"],
264
- ["Japanese garden with cherry blossoms", 'Hitokomoru Style', 40, 7.0, 789, 'Contrast', 250, "256x256"],
265
- ],
266
- inputs=[text, style, inference_step, guidance_scale, seed, guidance_method, loss_scale, image_size],
267
- outputs=[output_image, output_image_guided],
268
- fn=inference,
269
- cache_examples=True,
270
- examples_per_page=5
271
-
272
- )
273
-
274
- if __name__ == "__main__":
275
- demo.launch()
 
91
  css = """
92
  <style>
93
  body {
94
+ background: linear-gradient(135deg, #1a1c2c, #4a4e69, #9a8c98);
95
  font-family: 'Arial', sans-serif;
96
+ color: #f2e9e4;
97
+ margin: 0;
98
+ padding: 0;
99
+ min-height: 100vh;
100
  }
101
  #app-header {
102
  text-align: center;
103
+ background: rgba(255, 255, 255, 0.1);
104
  padding: 30px;
105
  border-radius: 20px;
106
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
107
  position: relative;
108
  overflow: hidden;
109
+ margin: 20px auto;
110
+ max-width: 800px;
111
  }
112
  #app-header::before {
113
  content: "";
 
116
  left: -50%;
117
  width: 200%;
118
  height: 200%;
119
+ background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
120
+ animation: shimmer 15s infinite linear;
121
  }
122
  @keyframes shimmer {
123
  0% { transform: rotate(0deg); }
124
  100% { transform: rotate(360deg); }
125
  }
126
  #app-header h1 {
127
+ color: #f2e9e4;
128
  font-size: 2.5em;
129
  margin-bottom: 15px;
130
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
131
  }
132
  #app-header p {
133
  font-size: 1.2em;
134
+ color: #c9ada7;
135
  }
136
  .concept-container {
137
  display: flex;
138
  justify-content: center;
139
+ gap: 20px;
140
  margin-top: 30px;
141
  flex-wrap: wrap;
142
  }
 
145
  transition: transform 0.3s, box-shadow 0.3s;
146
  border-radius: 15px;
147
  overflow: hidden;
148
+ background: rgba(255, 255, 255, 0.1);
149
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
150
+ width: 150px;
151
  }
152
  .concept:hover {
153
  transform: translateY(-10px) rotate(3deg);
154
+ box-shadow: 0 15px 30px rgba(0,0,0,0.4);
155
  }
156
  .concept img {
157
+ width: 100%;
158
  height: 120px;
159
  object-fit: cover;
 
160
  }
161
  .concept-description {
162
+ background-color: rgba(110, 72, 170, 0.8);
163
  color: white;
164
  padding: 10px;
165
  font-size: 0.9em;
 
167
  }
168
  .artifact {
169
  position: absolute;
170
+ background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
171
  border-radius: 50%;
172
  opacity: 0.5;
173
+ pointer-events: none;
174
  }
175
  .artifact.large {
176
  width: 400px;
 
199
  50% { transform: translateY(-20px) rotate(10deg); }
200
  }
201
  @keyframes pulse {
202
+ 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
203
+ 100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
204
+ }
205
+ /* Gradio component styling */
206
+ .gr-box {
207
+ background-color: rgba(255, 255, 255, 0.1) !important;
208
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
209
+ }
210
+ .gr-input, .gr-button {
211
+ background-color: rgba(255, 255, 255, 0.1) !important;
212
+ color: #f2e9e4 !important;
213
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
214
+ }
215
+ .gr-button:hover {
216
+ background-color: rgba(255, 255, 255, 0.2) !important;
217
+ }
218
+ .gr-form {
219
+ background-color: transparent !important;
220
  }
221
  </style>
222
  <div id="app-header">
 
227
  <p>Unleash your imagination with AI-powered generative art</p>
228
  <div class="concept-container">
229
  <div class="concept">
230
+ <img src="https://source.unsplash.com/random/150x120?illustration" alt="Illustration Style">
231
  <div class="concept-description">Illustration Style</div>
232
  </div>
233
  <div class="concept">
234
+ <img src="https://source.unsplash.com/random/150x120?line-art" alt="Line Art">
235
  <div class="concept-description">Line Art</div>
236
  </div>
237
  <div class="concept">
238
+ <img src="https://source.unsplash.com/random/150x120?digital-art" alt="Midjourney Style">
239
  <div class="concept-description">Midjourney Style</div>
240
  </div>
241
  <div class="concept">
242
+ <img src="https://source.unsplash.com/random/150x120?anime" alt="Hanfu Anime">
243
  <div class="concept-description">Hanfu Anime</div>
244
  </div>
245
  </div>
 
247
  """
248
 
249
  with gr.Blocks(css=css) as demo:
250
+ gr.HTML(css + open("path/to/your/html_structure.html").read())
251
 
252
  with gr.Row():
253
  text = gr.Textbox(label="Prompt", placeholder="Describe your dreamscape...")
 
279
  )
280
 
281
  gr.Examples(
282
+ examples=[
283
+ ["Floating island with waterfalls", 'Illustration Style', 50, 7.5, 42, 'Grayscale', 200, "256x256"],
284
+ ["Futuristic city with neon lights", 'Line Art', 30, 8.0, 123, 'Bright', 300, "256x256"],
285
+ ["Japanese garden with cherry blossoms", 'Hitokomoru Style', 40, 7.0, 789, 'Contrast', 250, "256x256"],
286
+ ],
287
+ inputs=[text, style, inference_step, guidance_scale, seed, guidance_method, loss_scale, image_size],
288
+ outputs=[output_image, output_image_guided],
289
+ fn=inference,
290
+ cache_examples=True,
291
+ examples_per_page=5
292
+ )