Laramie2 commited on
Commit
a21e552
·
verified ·
1 Parent(s): 3a9182a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -224,7 +224,6 @@ def run_final_generation(task_type="all"):
224
  error_log = full_log + f"\n[全局异常] Exception occurred:\n{str(e)}"
225
  return "❌ 最终生成发生全局异常", get_debug_info(), error_log, None
226
 
227
-
228
  # ==========================================
229
  # --- 🚀 全新美化的 UI (Hugging Face 优化版) ---
230
  # ==========================================
@@ -252,7 +251,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as de
252
  with gr.Row():
253
  key_input = gr.Textbox(label="API Key", type="password", placeholder="sk-...", scale=1)
254
  api_base_url_input = gr.Textbox(label="Base URL (可选)", placeholder="https://api.example.com", scale=1)
255
- key_btn = gr.Button("💾 保存 API 配置", size="sm")
256
 
257
  # 2. 核心上传与解析
258
  with gr.Group():
@@ -260,7 +259,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as de
260
  pdf_input = gr.File(label="拖拽或点击上传 PDF", file_types=[".pdf"])
261
 
262
  with gr.Row():
263
- pdf_btn = gr.Button("📥 1. 加载文件", size="sm")
 
264
  parse_btn = gr.Button("🚀 2. 执行 Mineru & DAG 抽取", variant="primary")
265
 
266
  parse_status = gr.Textbox(label="解析进度", lines=1, interactive=False)
@@ -270,9 +270,11 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as de
270
  gr.Markdown("### 🎯 3. 产物生成")
271
  gr.Markdown("基于 DAG 结构生成最终所需格式:")
272
  with gr.Row():
273
- gen_ppt_btn = gr.Button("📊 PPT", size="sm")
274
- gen_poster_btn = gr.Button("🖼️ Poster", size="sm")
275
- gen_pr_btn = gr.Button("📰 PR 文章", size="sm")
 
 
276
  gen_all_btn = gr.Button("✨ 一键生成全部 (ALL)", variant="primary")
277
 
278
  # ================= 右侧:状态与日志监控区 =================
@@ -295,7 +297,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as de
295
 
296
  # Tab 3: 文件系统快照
297
  with gr.Tab("🔍 系统快照 (Debug)"):
298
- refresh_btn = gr.Button("🔄 刷新目录树", size="sm")
299
  debug_view = gr.Textbox(label="Workspace Files", lines=20, interactive=False, value=get_debug_info())
300
 
301
  # ================= 逻辑绑定 =================
 
224
  error_log = full_log + f"\n[全局异常] Exception occurred:\n{str(e)}"
225
  return "❌ 最终生成发生全局异常", get_debug_info(), error_log, None
226
 
 
227
  # ==========================================
228
  # --- 🚀 全新美化的 UI (Hugging Face 优化版) ---
229
  # ==========================================
 
251
  with gr.Row():
252
  key_input = gr.Textbox(label="API Key", type="password", placeholder="sk-...", scale=1)
253
  api_base_url_input = gr.Textbox(label="Base URL (可选)", placeholder="https://api.example.com", scale=1)
254
+ key_btn = gr.Button("💾 保存 API 配置") # 统一尺寸
255
 
256
  # 2. 核心上传与解析
257
  with gr.Group():
 
259
  pdf_input = gr.File(label="拖拽或点击上传 PDF", file_types=[".pdf"])
260
 
261
  with gr.Row():
262
+ # 去掉 size="sm",使其与右侧 primary 按钮等高对齐
263
+ pdf_btn = gr.Button("📥 1. 加载文件")
264
  parse_btn = gr.Button("🚀 2. 执行 Mineru & DAG 抽取", variant="primary")
265
 
266
  parse_status = gr.Textbox(label="解析进度", lines=1, interactive=False)
 
270
  gr.Markdown("### 🎯 3. 产物生成")
271
  gr.Markdown("基于 DAG 结构生成最终所需格式:")
272
  with gr.Row():
273
+ # 去掉 size="sm",让这三个按钮等高且填满当前行
274
+ gen_ppt_btn = gr.Button("📊 PPT")
275
+ gen_poster_btn = gr.Button("🖼️ Poster")
276
+ gen_pr_btn = gr.Button("📰 PR 文章")
277
+ # 下方的 ALL 按钮也是默认尺寸,整体模块视觉统一
278
  gen_all_btn = gr.Button("✨ 一键生成全部 (ALL)", variant="primary")
279
 
280
  # ================= 右侧:状态与日志监控区 =================
 
297
 
298
  # Tab 3: 文件系统快照
299
  with gr.Tab("🔍 系统快照 (Debug)"):
300
+ refresh_btn = gr.Button("🔄 刷新目录树") # 统一尺寸
301
  debug_view = gr.Textbox(label="Workspace Files", lines=20, interactive=False, value=get_debug_info())
302
 
303
  # ================= 逻辑绑定 =================