Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -221,11 +221,11 @@ with gr.Blocks(
|
|
| 221 |
}
|
| 222 |
|
| 223 |
.gr-button {
|
| 224 |
-
border-radius:
|
| 225 |
-
font-weight:
|
| 226 |
-
padding:
|
| 227 |
-
transition: 0.
|
| 228 |
-
box-shadow: 0
|
| 229 |
}
|
| 230 |
|
| 231 |
#generate-btn,
|
|
@@ -235,8 +235,8 @@ with gr.Blocks(
|
|
| 235 |
#done-btn,
|
| 236 |
#tts-btn,
|
| 237 |
#recreate-scene-index {
|
| 238 |
-
background-color: #
|
| 239 |
-
color:
|
| 240 |
border: 1px solid #000000;
|
| 241 |
}
|
| 242 |
|
|
@@ -265,10 +265,10 @@ with gr.Blocks(
|
|
| 265 |
#reset-btn:hover,
|
| 266 |
#done-btn:hover,
|
| 267 |
#tts-btn:hover{
|
| 268 |
-
background: linear-gradient(
|
| 269 |
-
|
|
|
|
| 270 |
cursor: pointer;
|
| 271 |
-
transition: background 0.3s ease;
|
| 272 |
}
|
| 273 |
|
| 274 |
#theme-input,
|
|
@@ -302,6 +302,27 @@ with gr.Blocks(
|
|
| 302 |
outline: none;
|
| 303 |
|
| 304 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
|
| 306 |
.gr-accordion {
|
| 307 |
background-color: #d4a373;
|
|
@@ -335,10 +356,27 @@ with gr.Blocks(
|
|
| 335 |
font-family: 'Comic Sans MS', cursive, sans-serif;
|
| 336 |
}
|
| 337 |
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
}
|
| 343 |
|
| 344 |
""") as demo:
|
|
@@ -346,24 +384,24 @@ with gr.Blocks(
|
|
| 346 |
gr.Markdown("Describe your story one scene at a time, with AI-generated images, summaries, and explanations.\nPut your own GOOGLE API KEY (named as GOOGLE_API_KEY) in the SECRET VARIABLE.")
|
| 347 |
|
| 348 |
with gr.Accordion("π§© Story Setup", open=True):
|
| 349 |
-
title = gr.Textbox(label="π Story Title", placeholder="e.g. The Enchanted Forest")
|
| 350 |
-
scene_total = gr.Number(label="π’ Number of Scenes", precision=0, value=3, elem_id="
|
| 351 |
-
theme = gr.Textbox(label="π Global Theme", placeholder="e.g. A magical forest full of glowing creatures", elem_id="
|
| 352 |
|
| 353 |
gr.Markdown("### β¨ Describe Your Next Scene")
|
| 354 |
|
| 355 |
with gr.Group():
|
| 356 |
with gr.Row():
|
| 357 |
-
char_count = gr.Number(label="π₯ Number of Characters", precision=0, value=2, elem_id="
|
| 358 |
-
character_names = gr.Textbox(label="π§ββοΈ Character Names", elem_id="
|
| 359 |
with gr.Row():
|
| 360 |
-
dialogue = gr.Textbox(label="π¬ Dialogue (optional)", placeholder="e.g. 'Protect the forest!'", elem_id="
|
| 361 |
-
dialogue_speaker = gr.Textbox(label="π£οΈ Who says the dialogue?", placeholder="e.g. Bramble", elem_id = "
|
| 362 |
|
| 363 |
with gr.Row():
|
| 364 |
-
char_styles = gr.Textbox(label="π§₯ Outfit Descriptions", placeholder="e.g. Elora wears a leafy cloak, Bramble has a warrior vest", elem_id="
|
| 365 |
-
char_moods = gr.Textbox(label="π Character Moods", placeholder="e.g. Elora is cautious, Bramble is brave", elem_id="
|
| 366 |
-
bg_style = gr.Dropdown(label="π¨ Background Style", choices=["Realistic", "Cartoon", "Fantasy", "Dark Fantasy"], value="Fantasy", elem_id="
|
| 367 |
|
| 368 |
with gr.Row():
|
| 369 |
generate_btn = gr.Button("β Generate The Scene", elem_id="generate-btn")
|
|
@@ -373,7 +411,7 @@ with gr.Blocks(
|
|
| 373 |
recreate_btn = gr.Button("π Recreate The Scene", elem_id="recreate-btn")
|
| 374 |
reset_btn = gr.Button("\nβοΈ Reset", elem_id="reset-btn")
|
| 375 |
|
| 376 |
-
status = gr.Markdown()
|
| 377 |
image_output = gr.Image(label="πΌοΈ Scene Image", type="pil")
|
| 378 |
summary_output = gr.Markdown(label="π Scene Summary")
|
| 379 |
explanation_output = gr.Textbox(label="π Scene Explanation", lines=6)
|
|
|
|
| 221 |
}
|
| 222 |
|
| 223 |
.gr-button {
|
| 224 |
+
border-radius: 10px;
|
| 225 |
+
font-weight: bold;
|
| 226 |
+
padding: 12px 24px;
|
| 227 |
+
transition: all 0.4s ease;
|
| 228 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.15);
|
| 229 |
}
|
| 230 |
|
| 231 |
#generate-btn,
|
|
|
|
| 235 |
#done-btn,
|
| 236 |
#tts-btn,
|
| 237 |
#recreate-scene-index {
|
| 238 |
+
background-color: linear-gradient(135deg, #a18cd1, #fbc2eb);
|
| 239 |
+
color: white;
|
| 240 |
border: 1px solid #000000;
|
| 241 |
}
|
| 242 |
|
|
|
|
| 265 |
#reset-btn:hover,
|
| 266 |
#done-btn:hover,
|
| 267 |
#tts-btn:hover{
|
| 268 |
+
background: linear-gradient(135deg, #ff9a9e, #fad0c4);
|
| 269 |
+
transform: scale(1.05);
|
| 270 |
+
color: #000;
|
| 271 |
cursor: pointer;
|
|
|
|
| 272 |
}
|
| 273 |
|
| 274 |
#theme-input,
|
|
|
|
| 302 |
outline: none;
|
| 303 |
|
| 304 |
}
|
| 305 |
+
|
| 306 |
+
input, textarea, select {
|
| 307 |
+
border-radius: 8px !important;
|
| 308 |
+
border: 1px solid #ccc !important;
|
| 309 |
+
padding: 10px !important;
|
| 310 |
+
background-color: #fff5fc;
|
| 311 |
+
box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
|
| 312 |
+
transition: all 0.2s ease-in-out;
|
| 313 |
+
}
|
| 314 |
+
input:focus, textarea:focus, select:focus {
|
| 315 |
+
border-color: #ff80ab !important;
|
| 316 |
+
box-shadow: 0 0 6px rgba(255, 105, 180, 0.3);
|
| 317 |
+
outline: none;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
/* π Scene Image Border */
|
| 321 |
+
.gr-image img {
|
| 322 |
+
border: 4px dashed #ffb6b9;
|
| 323 |
+
border-radius: 16px;
|
| 324 |
+
padding: 4px;
|
| 325 |
+
}
|
| 326 |
|
| 327 |
.gr-accordion {
|
| 328 |
background-color: #d4a373;
|
|
|
|
| 356 |
font-family: 'Comic Sans MS', cursive, sans-serif;
|
| 357 |
}
|
| 358 |
|
| 359 |
+
@keyframes float {
|
| 360 |
+
0% { transform: translateY(0px); }
|
| 361 |
+
50% { transform: translateY(-10px); }
|
| 362 |
+
100% { transform: translateY(0px); }
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
@keyframes floatX {
|
| 366 |
+
0% { transform: translateX(0); }
|
| 367 |
+
50% { transform: translateX(15px); }
|
| 368 |
+
100% { transform: translateX(0); }
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
@keyframes pulseColor {
|
| 372 |
+
0% { color: #ff4081; }
|
| 373 |
+
50% { color: #7e57c2; }
|
| 374 |
+
100% { color: #42a5f5; }
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
@keyframes backgroundMove {
|
| 378 |
+
0% { background-position: 0% 50%; }
|
| 379 |
+
100% { background-position: 100% 50%; }
|
| 380 |
}
|
| 381 |
|
| 382 |
""") as demo:
|
|
|
|
| 384 |
gr.Markdown("Describe your story one scene at a time, with AI-generated images, summaries, and explanations.\nPut your own GOOGLE API KEY (named as GOOGLE_API_KEY) in the SECRET VARIABLE.")
|
| 385 |
|
| 386 |
with gr.Accordion("π§© Story Setup", open=True):
|
| 387 |
+
title = gr.Textbox(label="π Story Title", placeholder="e.g. The Enchanted Forest",elem_id="textarea")
|
| 388 |
+
scene_total = gr.Number(label="π’ Number of Scenes", precision=0, value=3, elem_id="input")
|
| 389 |
+
theme = gr.Textbox(label="π Global Theme", placeholder="e.g. A magical forest full of glowing creatures", elem_id="textarea")
|
| 390 |
|
| 391 |
gr.Markdown("### β¨ Describe Your Next Scene")
|
| 392 |
|
| 393 |
with gr.Group():
|
| 394 |
with gr.Row():
|
| 395 |
+
char_count = gr.Number(label="π₯ Number of Characters", precision=0, value=2, elem_id="input")
|
| 396 |
+
character_names = gr.Textbox(label="π§ββοΈ Character Names", elem_id="textarea")
|
| 397 |
with gr.Row():
|
| 398 |
+
dialogue = gr.Textbox(label="π¬ Dialogue (optional)", placeholder="e.g. 'Protect the forest!'", elem_id="textarea")
|
| 399 |
+
dialogue_speaker = gr.Textbox(label="π£οΈ Who says the dialogue?", placeholder="e.g. Bramble", elem_id = "txtarea")
|
| 400 |
|
| 401 |
with gr.Row():
|
| 402 |
+
char_styles = gr.Textbox(label="π§₯ Outfit Descriptions", placeholder="e.g. Elora wears a leafy cloak, Bramble has a warrior vest", elem_id="textarea")
|
| 403 |
+
char_moods = gr.Textbox(label="π Character Moods", placeholder="e.g. Elora is cautious, Bramble is brave", elem_id="textarea")
|
| 404 |
+
bg_style = gr.Dropdown(label="π¨ Background Style", choices=["Realistic", "Cartoon", "Fantasy", "Dark Fantasy"], value="Fantasy", elem_id="select")
|
| 405 |
|
| 406 |
with gr.Row():
|
| 407 |
generate_btn = gr.Button("β Generate The Scene", elem_id="generate-btn")
|
|
|
|
| 411 |
recreate_btn = gr.Button("π Recreate The Scene", elem_id="recreate-btn")
|
| 412 |
reset_btn = gr.Button("\nβοΈ Reset", elem_id="reset-btn")
|
| 413 |
|
| 414 |
+
status = gr.Markdown(class=gr-image)
|
| 415 |
image_output = gr.Image(label="πΌοΈ Scene Image", type="pil")
|
| 416 |
summary_output = gr.Markdown(label="π Scene Summary")
|
| 417 |
explanation_output = gr.Textbox(label="π Scene Explanation", lines=6)
|