Laramie2 commited on
Commit
8fca19f
·
verified ·
1 Parent(s): 1636145

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -238,7 +238,7 @@ def run_mineru_parsing_and_dag_gen(session_id, api_key, api_base_url, progress=g
238
  progress(0.8, desc="构建图结构中...")
239
  for line in iter(process_dag.stdout.readline, ''):
240
  full_log += line
241
- yield create_progress_html(80, "⏳ Building Graph...", "active"), get_debug_info(session_id), full_log, no_change, no_change, no_change, no_change
242
  process_dag.stdout.close()
243
  returncode_dag = process_dag.wait()
244
 
@@ -581,6 +581,18 @@ with gr.Blocks(theme=purple_theme, css=custom_css) as demo:
581
  # 4. Results & Downloads
582
  with gr.Group(elem_classes="gradio-group"):
583
  gr.Markdown("### 📦 Generation Results & Download")
 
 
 
 
 
 
 
 
 
 
 
 
584
  download_file = gr.File(label="📥 Get Final Zip Archive", interactive=False, visible=False)
585
 
586
  # 5. Debugging
@@ -644,5 +656,15 @@ with gr.Blocks(theme=purple_theme, css=custom_css) as demo:
644
 
645
  refresh_btn.click(fn=get_debug_info, inputs=[session_id_state], outputs=debug_view)
646
 
 
 
 
 
 
 
 
 
 
 
647
  if __name__ == "__main__":
648
  demo.queue(default_concurrency_limit=5).launch()
 
238
  progress(0.8, desc="构建图结构中...")
239
  for line in iter(process_dag.stdout.readline, ''):
240
  full_log += line
241
+ yield create_progress_html(80, "⏳ Building DAG...", "active"), get_debug_info(session_id), full_log, no_change, no_change, no_change, no_change
242
  process_dag.stdout.close()
243
  returncode_dag = process_dag.wait()
244
 
 
581
  # 4. Results & Downloads
582
  with gr.Group(elem_classes="gradio-group"):
583
  gr.Markdown("### 📦 Generation Results & Download")
584
+
585
+ # --- 新增:无输出时的美化空状态提示词 ---
586
+ download_placeholder = gr.HTML(
587
+ '''
588
+ <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 160px; border: 2px dashed rgba(192, 132, 252, 0.6); border-radius: 16px; background-color: rgba(250, 245, 255, 0.5); color: #9333EA; text-align: center; transition: all 0.3s ease;">
589
+ <span style="font-size: 32px; margin-bottom: 8px;">📦</span>
590
+ <span style="font-weight: 600; font-size: 16px; margin-bottom: 4px;">Awaiting Generation</span>
591
+ <span style="font-size: 13px; color: #A855F7; opacity: 0.8;">Generated assets will appear here as a downloadable ZIP archive.</span>
592
+ </div>
593
+ '''
594
+ )
595
+
596
  download_file = gr.File(label="📥 Get Final Zip Archive", interactive=False, visible=False)
597
 
598
  # 5. Debugging
 
656
 
657
  refresh_btn.click(fn=get_debug_info, inputs=[session_id_state], outputs=debug_view)
658
 
659
+ def toggle_empty_placeholder(file_val):
660
+ # 如果获取到了文件(值不为空),就隐藏占位提示词;否则保持显示
661
+ return gr.update(visible=(file_val is None))
662
+
663
+ download_file.change(
664
+ fn=toggle_empty_placeholder,
665
+ inputs=[download_file],
666
+ outputs=[download_placeholder]
667
+ )
668
+
669
  if __name__ == "__main__":
670
  demo.queue(default_concurrency_limit=5).launch()