Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -233,28 +233,36 @@ def format_output(plan_text):
|
|
| 233 |
"""
|
| 234 |
return styled_html
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
# def create_gradio_app():
|
| 237 |
# with gr.Blocks(css="""
|
| 238 |
# .gradio-container {
|
| 239 |
-
# background:
|
|
|
|
| 240 |
# font-family: 'Segoe UI', sans-serif;
|
| 241 |
# padding: 30px;
|
| 242 |
# }
|
| 243 |
# .main-title {
|
| 244 |
# text-align: center;
|
| 245 |
-
# font-size:
|
| 246 |
# font-weight: bold;
|
| 247 |
-
#
|
| 248 |
-
#
|
|
|
|
| 249 |
# }
|
| 250 |
# .sub-title {
|
| 251 |
# text-align: center;
|
| 252 |
-
# font-size:
|
| 253 |
-
#
|
|
|
|
|
|
|
| 254 |
# margin-bottom: 30px;
|
| 255 |
# }
|
| 256 |
# .gradio-button {
|
| 257 |
-
# background-color: #
|
| 258 |
# color: white;
|
| 259 |
# font-size: 18px;
|
| 260 |
# padding: 14px;
|
|
@@ -262,7 +270,7 @@ def format_output(plan_text):
|
|
| 262 |
# margin-top: 20px;
|
| 263 |
# }
|
| 264 |
# .gradio-button:hover {
|
| 265 |
-
# background-color: #
|
| 266 |
# }
|
| 267 |
# #output-box {
|
| 268 |
# height: 600px;
|
|
@@ -300,154 +308,74 @@ def format_output(plan_text):
|
|
| 300 |
|
| 301 |
# demo.launch()
|
| 302 |
|
| 303 |
-
# def create_gradio_app():
|
| 304 |
-
# with gr.Blocks(css="""
|
| 305 |
-
# .gradio-container {
|
| 306 |
-
# background: linear-gradient(to right, #3c3b6e, #121062);
|
| 307 |
-
# font-family: 'Cinzel', serif;
|
| 308 |
-
# padding: 40px;
|
| 309 |
-
# }
|
| 310 |
-
# .main-title {
|
| 311 |
-
# text-align: center;
|
| 312 |
-
# font-size: 48px;
|
| 313 |
-
# font-weight: bold;
|
| 314 |
-
# color: #f1c40f;
|
| 315 |
-
# margin-bottom: 20px;
|
| 316 |
-
# }
|
| 317 |
-
# .sub-title {
|
| 318 |
-
# text-align: center;
|
| 319 |
-
# font-size: 20px;
|
| 320 |
-
# color: #ecf0f1;
|
| 321 |
-
# margin-bottom: 40px;
|
| 322 |
-
# }
|
| 323 |
-
# .gradio-button {
|
| 324 |
-
# background-color: #8e44ad;
|
| 325 |
-
# color: white;
|
| 326 |
-
# font-size: 20px;
|
| 327 |
-
# padding: 16px;
|
| 328 |
-
# border-radius: 10px;
|
| 329 |
-
# margin-top: 30px;
|
| 330 |
-
# width: 100%;
|
| 331 |
-
# }
|
| 332 |
-
# .gradio-button:hover {
|
| 333 |
-
# background-color: #9b59b6;
|
| 334 |
-
# }
|
| 335 |
-
# #output-box {
|
| 336 |
-
# height: 600px;
|
| 337 |
-
# overflow-y: scroll;
|
| 338 |
-
# padding: 20px;
|
| 339 |
-
# background-color: #ecf0f1;
|
| 340 |
-
# border: 1px solid #dcdde1;
|
| 341 |
-
# border-radius: 12px;
|
| 342 |
-
# box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 343 |
-
# margin-top: 20px;
|
| 344 |
-
# }
|
| 345 |
-
# .gradio-input {
|
| 346 |
-
# background-color: #ecf0f1;
|
| 347 |
-
# border-radius: 8px;
|
| 348 |
-
# padding: 10px;
|
| 349 |
-
# border: 1px solid #dcdde1;
|
| 350 |
-
# font-size: 16px;
|
| 351 |
-
# }
|
| 352 |
-
# .gradio-input:focus {
|
| 353 |
-
# outline: none;
|
| 354 |
-
# border-color: #8e44ad;
|
| 355 |
-
# }
|
| 356 |
-
# .gradio-column {
|
| 357 |
-
# display: flex;
|
| 358 |
-
# justify-content: center;
|
| 359 |
-
# }
|
| 360 |
-
# .loading {
|
| 361 |
-
# color: #f39c12;
|
| 362 |
-
# font-size: 18px;
|
| 363 |
-
# text-align: center;
|
| 364 |
-
# }
|
| 365 |
-
# """) as demo:
|
| 366 |
-
# gr.Markdown("<div class='main-title'>Fantasy Novel Outline Generator</div>")
|
| 367 |
-
# gr.Markdown("<div class='sub-title'>Turn your novel idea into a rich, detailed outline with AI-powered agents.</div>")
|
| 368 |
-
|
| 369 |
-
# with gr.Row():
|
| 370 |
-
# with gr.Column(scale=1):
|
| 371 |
-
# user_idea = gr.Textbox(
|
| 372 |
-
# label="Enter Your Fantasy Novel Idea",
|
| 373 |
-
# placeholder="e.g., A young orphan discovers they're heir to a ruined magical kingdom...",
|
| 374 |
-
# lines=5,
|
| 375 |
-
# interactive=True,
|
| 376 |
-
# elem_classes="gradio-input"
|
| 377 |
-
# )
|
| 378 |
-
|
| 379 |
-
# generate_btn = gr.Button("Generate Outline", elem_classes="gradio-button")
|
| 380 |
-
|
| 381 |
-
# with gr.Column(scale=2):
|
| 382 |
-
# output_html = gr.HTML(label="AI-Generated Outline", elem_id="output-box")
|
| 383 |
-
|
| 384 |
-
# # Add a loading message for user feedback
|
| 385 |
-
# loading_message = gr.Markdown("<div class='loading'>Generating outline, please wait...</div>", visible=False)
|
| 386 |
-
|
| 387 |
-
# # Button logic
|
| 388 |
-
# def generate_and_format_output(idea):
|
| 389 |
-
# loading_message.visible = True
|
| 390 |
-
# result = generate_fantasy_outline(idea)
|
| 391 |
-
# formatted_result = format_output(result)
|
| 392 |
-
# loading_message.visible = False
|
| 393 |
-
# return formatted_result
|
| 394 |
-
|
| 395 |
-
# generate_btn.click(
|
| 396 |
-
# fn=generate_and_format_output,
|
| 397 |
-
# inputs=[user_idea],
|
| 398 |
-
# outputs=output_html
|
| 399 |
-
# )
|
| 400 |
-
|
| 401 |
-
# demo.launch()
|
| 402 |
-
|
| 403 |
-
|
| 404 |
def create_gradio_app():
|
| 405 |
with gr.Blocks(css="""
|
| 406 |
-
|
| 407 |
-
background: url('
|
| 408 |
background-size: cover;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
font-family: 'Segoe UI', sans-serif;
|
| 410 |
padding: 30px;
|
|
|
|
| 411 |
}
|
| 412 |
.main-title {
|
| 413 |
text-align: center;
|
| 414 |
-
font-size:
|
| 415 |
font-weight: bold;
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
}
|
| 420 |
.sub-title {
|
| 421 |
text-align: center;
|
| 422 |
-
font-size:
|
| 423 |
-
|
| 424 |
-
font-style: italic;
|
| 425 |
-
color: #D1C6E1;
|
| 426 |
margin-bottom: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
}
|
| 428 |
.gradio-button {
|
| 429 |
-
background-color: #
|
| 430 |
-
color: white;
|
| 431 |
-
font-size: 18px;
|
| 432 |
-
padding:
|
| 433 |
-
border-radius: 8px;
|
| 434 |
-
margin-top: 20px;
|
|
|
|
| 435 |
}
|
| 436 |
.gradio-button:hover {
|
| 437 |
-
background-color: #
|
|
|
|
| 438 |
}
|
| 439 |
#output-box {
|
| 440 |
height: 600px;
|
| 441 |
overflow-y: scroll;
|
| 442 |
padding: 20px;
|
| 443 |
-
background-color:
|
| 444 |
border: 1px solid #ccc;
|
| 445 |
border-radius: 12px;
|
| 446 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
}
|
| 448 |
""") as demo:
|
|
|
|
|
|
|
|
|
|
| 449 |
gr.Markdown("<div class='main-title'>Fantasy Novel Outline Generator</div>")
|
| 450 |
-
gr.Markdown("<div class='sub-title'>Turn your novel idea into a rich, detailed outline with AI-powered agents
|
| 451 |
|
| 452 |
with gr.Row():
|
| 453 |
with gr.Column(scale=1):
|
|
@@ -457,13 +385,11 @@ def create_gradio_app():
|
|
| 457 |
lines=5,
|
| 458 |
interactive=True
|
| 459 |
)
|
| 460 |
-
|
| 461 |
generate_btn = gr.Button("Generate Outline", elem_classes="gradio-button")
|
| 462 |
|
| 463 |
with gr.Column(scale=2):
|
| 464 |
output_html = gr.HTML(label="AI-Generated Outline", elem_id="output-box")
|
| 465 |
|
| 466 |
-
# Button logic
|
| 467 |
generate_btn.click(
|
| 468 |
fn=lambda idea: format_output(generate_fantasy_outline(idea)),
|
| 469 |
inputs=[user_idea],
|
|
|
|
| 233 |
"""
|
| 234 |
return styled_html
|
| 235 |
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
# def create_gradio_app():
|
| 241 |
# with gr.Blocks(css="""
|
| 242 |
# .gradio-container {
|
| 243 |
+
# background: url('https://img.freepik.com/free-ai-image/fantasy-landscape-floating-islands-illustration_355026699.htm#fromView=keyword&page=1&position=3&uuid=c5b6d86a-b71a-47da-9593-ce6dc72d2fbd&query=Fantasy+Background') no-repeat center center fixed;
|
| 244 |
+
# background-size: cover;
|
| 245 |
# font-family: 'Segoe UI', sans-serif;
|
| 246 |
# padding: 30px;
|
| 247 |
# }
|
| 248 |
# .main-title {
|
| 249 |
# text-align: center;
|
| 250 |
+
# font-size: 60px;
|
| 251 |
# font-weight: bold;
|
| 252 |
+
# font-style: italic;
|
| 253 |
+
# color: #FAF3E0;
|
| 254 |
+
# margin-bottom: 20px;
|
| 255 |
# }
|
| 256 |
# .sub-title {
|
| 257 |
# text-align: center;
|
| 258 |
+
# font-size: 28px;
|
| 259 |
+
# font-weight: bold;
|
| 260 |
+
# font-style: italic;
|
| 261 |
+
# color: #D1C6E1;
|
| 262 |
# margin-bottom: 30px;
|
| 263 |
# }
|
| 264 |
# .gradio-button {
|
| 265 |
+
# background-color: #A2C2E1;
|
| 266 |
# color: white;
|
| 267 |
# font-size: 18px;
|
| 268 |
# padding: 14px;
|
|
|
|
| 270 |
# margin-top: 20px;
|
| 271 |
# }
|
| 272 |
# .gradio-button:hover {
|
| 273 |
+
# background-color: #A8E6CF;
|
| 274 |
# }
|
| 275 |
# #output-box {
|
| 276 |
# height: 600px;
|
|
|
|
| 308 |
|
| 309 |
# demo.launch()
|
| 310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
def create_gradio_app():
|
| 312 |
with gr.Blocks(css="""
|
| 313 |
+
body {
|
| 314 |
+
background-image: url('file=fantasy-landscape-floating-islands-illustration.jpg'); /* Use your image path */
|
| 315 |
background-size: cover;
|
| 316 |
+
background-position: center;
|
| 317 |
+
background-attachment: fixed;
|
| 318 |
+
}
|
| 319 |
+
.gradio-container {
|
| 320 |
font-family: 'Segoe UI', sans-serif;
|
| 321 |
padding: 30px;
|
| 322 |
+
background: rgba(255, 255, 255, 0.1); /* Slightly transparent container */
|
| 323 |
}
|
| 324 |
.main-title {
|
| 325 |
text-align: center;
|
| 326 |
+
font-size: 72px !important; /* Even larger title */
|
| 327 |
font-weight: bold;
|
| 328 |
+
color: #ffffff;
|
| 329 |
+
margin-bottom: 10px;
|
| 330 |
+
text-shadow: 3px 3px 10px rgba(0,0,0,0.9);
|
| 331 |
+
padding: 25px;
|
| 332 |
+
background: rgba(44, 62, 80, 0.7);
|
| 333 |
+
border-radius: 15px;
|
| 334 |
+
text-transform: uppercase;
|
| 335 |
+
letter-spacing: 2px;
|
| 336 |
}
|
| 337 |
.sub-title {
|
| 338 |
text-align: center;
|
| 339 |
+
font-size: 22px;
|
| 340 |
+
color: #ffffff;
|
|
|
|
|
|
|
| 341 |
margin-bottom: 30px;
|
| 342 |
+
text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
|
| 343 |
+
background: rgba(0, 0, 0, 0.5);
|
| 344 |
+
padding: 10px;
|
| 345 |
+
border-radius: 8px;
|
| 346 |
}
|
| 347 |
.gradio-button {
|
| 348 |
+
background-color: #4CAF50 !important;
|
| 349 |
+
color: white !important;
|
| 350 |
+
font-size: 18px !important;
|
| 351 |
+
padding: 16px 24px !important;
|
| 352 |
+
border-radius: 8px !important;
|
| 353 |
+
margin-top: 20px !important;
|
| 354 |
+
border: none !important;
|
| 355 |
}
|
| 356 |
.gradio-button:hover {
|
| 357 |
+
background-color: #45a049 !important;
|
| 358 |
+
transform: scale(1.02);
|
| 359 |
}
|
| 360 |
#output-box {
|
| 361 |
height: 600px;
|
| 362 |
overflow-y: scroll;
|
| 363 |
padding: 20px;
|
| 364 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 365 |
border: 1px solid #ccc;
|
| 366 |
border-radius: 12px;
|
| 367 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
|
| 368 |
+
}
|
| 369 |
+
.gradio-interface {
|
| 370 |
+
max-width: 1200px;
|
| 371 |
+
margin: 0 auto;
|
| 372 |
}
|
| 373 |
""") as demo:
|
| 374 |
+
# Add hidden image component to serve the background
|
| 375 |
+
gr.Image("your_image_path.jpg", visible=False, elem_id="bg-image")
|
| 376 |
+
|
| 377 |
gr.Markdown("<div class='main-title'>Fantasy Novel Outline Generator</div>")
|
| 378 |
+
gr.Markdown("<div class='sub-title'>Turn your novel idea into a rich, detailed outline with AI-powered agents</div>")
|
| 379 |
|
| 380 |
with gr.Row():
|
| 381 |
with gr.Column(scale=1):
|
|
|
|
| 385 |
lines=5,
|
| 386 |
interactive=True
|
| 387 |
)
|
|
|
|
| 388 |
generate_btn = gr.Button("Generate Outline", elem_classes="gradio-button")
|
| 389 |
|
| 390 |
with gr.Column(scale=2):
|
| 391 |
output_html = gr.HTML(label="AI-Generated Outline", elem_id="output-box")
|
| 392 |
|
|
|
|
| 393 |
generate_btn.click(
|
| 394 |
fn=lambda idea: format_output(generate_fantasy_outline(idea)),
|
| 395 |
inputs=[user_idea],
|