Yoyo2004 commited on
Commit
dabaa03
·
verified ·
1 Parent(s): 56fcf31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -19
app.py CHANGED
@@ -1,6 +1,6 @@
1
- import gradio as gr
2
  import os
3
  import time
 
4
  from gradio_client import Client
5
 
6
  # ==========================================
@@ -347,10 +347,6 @@ def bridge_to_backend(premise):
347
  error_msg = f"{log_buffer}\n❌ [CRITICAL FAILURE]: {str(e)}\n"
348
  yield error_msg, None, None, None, None
349
 
350
- # ==========================================
351
- # 构建前端界面
352
- # ==========================================
353
-
354
  theme = gr.themes.Soft(
355
  primary_hue="indigo",
356
  secondary_hue="slate",
@@ -360,8 +356,7 @@ theme = gr.themes.Soft(
360
  )
361
 
362
  with gr.Blocks(theme=theme, css=custom_css, title="LongStory AI Pro") as demo:
363
-
364
- # --- Header ---
365
  with gr.Row(elem_classes=["header-box"]):
366
  gr.HTML("""
367
  <div class="title-wrapper">
@@ -371,10 +366,9 @@ with gr.Blocks(theme=theme, css=custom_css, title="LongStory AI Pro") as demo:
371
  <div class="subtitle-text">Deep Persona-Driven Recursive Novel Generation System</div>
372
  """)
373
 
374
- # --- Main Content ---
375
  with gr.Row(elem_classes=["main-container"]):
376
-
377
- # === Left Column: Control Center (Sticky) ===
378
  with gr.Column(scale=4, elem_classes=["control-panel-col"]):
379
  with gr.Column(elem_classes=["control-panel"]):
380
  gr.Markdown("### 💡 故事引擎 (Story Engine)", elem_id="input_title")
@@ -422,40 +416,37 @@ with gr.Blocks(theme=theme, css=custom_css, title="LongStory AI Pro") as demo:
422
  elem_classes=["terminal-log"],
423
  show_label=False
424
  )
425
-
426
- # === Right Column: Writing Desk ===
427
  with gr.Column(scale=8):
428
  with gr.Tabs(elem_classes=["tabs-container"]):
429
-
430
- # Tab 1: 正文 (Draft)
431
  with gr.TabItem("📖 正文 (Draft)", id="tab-story"):
432
  story_output = gr.Markdown(
433
  value="<br><br><div style='text-align: center; color: #9ca3af; font-family: Noto Serif SC;'><i>等待灵感注入...</i><br><small>故事将在此处生成</small></div>",
434
  elem_classes=["paper-wrapper"]
435
  )
436
 
437
- # Tab 2: 大纲 (Outline)
438
  with gr.TabItem("🗺️ 大纲 (Outline)", id="tab-outline"):
439
  outline_output = gr.JSON(
440
  label=None,
441
  elem_classes=["json-panel"]
442
  )
443
 
444
- # Tab 3: 规划 (Planning)
445
  with gr.TabItem("📅 规划 (Plan)", id="tab-planning"):
446
  plan_output = gr.JSON(
447
  label=None,
448
  elem_classes=["json-panel"]
449
  )
450
 
451
- # Tab 4: 人物 (Personas)
452
  with gr.TabItem("👥 档案 (Personas)", id="tab-persona"):
453
  persona_output = gr.JSON(
454
  label=None,
455
  elem_classes=["json-panel"]
456
  )
457
 
458
- # --- Interactions ---
459
  submit_btn.click(
460
  fn=bridge_to_backend,
461
  inputs=[premise_input],
@@ -463,6 +454,6 @@ with gr.Blocks(theme=theme, css=custom_css, title="LongStory AI Pro") as demo:
463
  concurrency_limit=1
464
  )
465
 
466
- # 启动
467
  if __name__ == "__main__":
468
  demo.queue().launch()
 
 
1
  import os
2
  import time
3
+ import gradio as gr
4
  from gradio_client import Client
5
 
6
  # ==========================================
 
347
  error_msg = f"{log_buffer}\n❌ [CRITICAL FAILURE]: {str(e)}\n"
348
  yield error_msg, None, None, None, None
349
 
 
 
 
 
350
  theme = gr.themes.Soft(
351
  primary_hue="indigo",
352
  secondary_hue="slate",
 
356
  )
357
 
358
  with gr.Blocks(theme=theme, css=custom_css, title="LongStory AI Pro") as demo:
359
+ # header
 
360
  with gr.Row(elem_classes=["header-box"]):
361
  gr.HTML("""
362
  <div class="title-wrapper">
 
366
  <div class="subtitle-text">Deep Persona-Driven Recursive Novel Generation System</div>
367
  """)
368
 
369
+ # content
370
  with gr.Row(elem_classes=["main-container"]):
371
+ # panel
 
372
  with gr.Column(scale=4, elem_classes=["control-panel-col"]):
373
  with gr.Column(elem_classes=["control-panel"]):
374
  gr.Markdown("### 💡 故事引擎 (Story Engine)", elem_id="input_title")
 
416
  elem_classes=["terminal-log"],
417
  show_label=False
418
  )
419
+ # writing content
 
420
  with gr.Column(scale=8):
421
  with gr.Tabs(elem_classes=["tabs-container"]):
422
+ # Tab 1: Draft
 
423
  with gr.TabItem("📖 正文 (Draft)", id="tab-story"):
424
  story_output = gr.Markdown(
425
  value="<br><br><div style='text-align: center; color: #9ca3af; font-family: Noto Serif SC;'><i>等待灵感注入...</i><br><small>故事将在此处生成</small></div>",
426
  elem_classes=["paper-wrapper"]
427
  )
428
 
429
+ # Tab 2: Outline
430
  with gr.TabItem("🗺️ 大纲 (Outline)", id="tab-outline"):
431
  outline_output = gr.JSON(
432
  label=None,
433
  elem_classes=["json-panel"]
434
  )
435
 
436
+ # Tab 3: Plan
437
  with gr.TabItem("📅 规划 (Plan)", id="tab-planning"):
438
  plan_output = gr.JSON(
439
  label=None,
440
  elem_classes=["json-panel"]
441
  )
442
 
443
+ # Tab 4: Personas
444
  with gr.TabItem("👥 档案 (Personas)", id="tab-persona"):
445
  persona_output = gr.JSON(
446
  label=None,
447
  elem_classes=["json-panel"]
448
  )
449
 
 
450
  submit_btn.click(
451
  fn=bridge_to_backend,
452
  inputs=[premise_input],
 
454
  concurrency_limit=1
455
  )
456
 
457
+ # start
458
  if __name__ == "__main__":
459
  demo.queue().launch()