Kal1510 commited on
Commit
9a9104e
·
verified ·
1 Parent(s): eb25916

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -39
app.py CHANGED
@@ -309,40 +309,52 @@ def format_output(plan_text):
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;
@@ -352,43 +364,45 @@ def create_gradio_app():
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):
382
  user_idea = gr.Textbox(
383
- label="Enter Your Fantasy Novel Idea",
384
- placeholder="e.g., A young orphan discovers they're heir to a ruined magical kingdom...",
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)),
@@ -398,4 +412,4 @@ def create_gradio_app():
398
 
399
  demo.launch()
400
 
401
- create_gradio_app()
 
309
  # demo.launch()
310
 
311
  def create_gradio_app():
312
+ # First add the image as a hidden component to make it available
313
+ background_image = gr.Image("your_image_path.jpg", visible=False, elem_id="bg-image")
314
+
315
  with gr.Blocks(css="""
316
+ :root {
317
+ --bg-opacity: 0.9;
318
+ }
319
+ #bg-image {
320
+ display: none; /* Hide the actual image element */
321
  }
322
  .gradio-container {
323
+ background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
324
+ url('file=your_image_path.jpg') !important;
325
+ background-size: cover !important;
326
+ background-position: center !important;
327
+ background-attachment: fixed !important;
328
+ min-height: 100vh;
329
  padding: 30px;
330
+ font-family: 'Segoe UI', sans-serif;
331
  }
332
  .main-title {
333
  text-align: center;
334
+ font-size: 72px !important;
335
+ font-weight: 800;
336
  color: #ffffff;
337
+ margin-bottom: 15px;
338
+ text-shadow: 3px 3px 12px #000000;
339
+ padding: 30px;
340
+ background: rgba(20, 20, 40, 0.7);
341
+ border-radius: 20px;
342
  text-transform: uppercase;
343
+ letter-spacing: 3px;
344
+ border: 2px solid rgba(255,255,255,0.2);
345
  }
346
  .sub-title {
347
  text-align: center;
348
  font-size: 22px;
349
  color: #ffffff;
350
+ margin-bottom: 40px;
351
+ text-shadow: 2px 2px 6px #000000;
352
+ background: rgba(0, 0, 0, 0.6);
353
+ padding: 15px;
354
+ border-radius: 10px;
355
+ max-width: 80%;
356
+ margin-left: auto;
357
+ margin-right: auto;
358
  }
359
  .gradio-button {
360
  background-color: #4CAF50 !important;
 
364
  border-radius: 8px !important;
365
  margin-top: 20px !important;
366
  border: none !important;
367
+ transition: all 0.3s ease !important;
368
  }
369
  .gradio-button:hover {
370
+ background-color: #3e8e41 !important;
371
+ transform: scale(1.05) !important;
372
+ box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
373
  }
374
  #output-box {
375
  height: 600px;
376
  overflow-y: scroll;
377
+ padding: 25px;
378
+ background-color: rgba(255, 255, 255, 0.92);
379
+ border: 1px solid #cccccc;
380
+ border-radius: 15px;
381
+ box-shadow: 0 6px 20px rgba(0,0,0,0.15);
382
+ }
383
+ .gradio-row {
384
+ margin-bottom: 30px;
385
  }
386
+ .gradio-column {
387
+ padding: 15px;
 
388
  }
389
  """) as demo:
 
 
390
 
391
+ gr.Markdown("""<div class='main-title'>FANTASY NOVEL OUTLINE GENERATOR</div>""")
392
+ gr.Markdown("""<div class='sub-title'>Transform your creative vision into a fully-developed fantasy world</div>""")
393
 
394
  with gr.Row():
395
  with gr.Column(scale=1):
396
  user_idea = gr.Textbox(
397
+ label="Your Fantasy Novel Concept",
398
+ placeholder="A hidden prophecy... a forgotten magic... an unlikely hero...",
399
  lines=5,
400
  interactive=True
401
  )
402
+ generate_btn = gr.Button("Craft My Outline", elem_classes="gradio-button")
403
 
404
  with gr.Column(scale=2):
405
+ output_html = gr.HTML(label="Your Generated Outline", elem_id="output-box")
406
 
407
  generate_btn.click(
408
  fn=lambda idea: format_output(generate_fantasy_outline(idea)),
 
412
 
413
  demo.launch()
414
 
415
+ create_gradio_app()