File size: 1,352 Bytes
b44ae07
bfedf71
b44ae07
 
0aee62c
bfedf71
b44ae07
 
 
 
 
 
 
 
 
 
 
bfedf71
 
 
 
b44ae07
 
 
 
 
 
 
bfedf71
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr
from apps import pdf_cropper, text_tools, text_diff

def create_main_interface():
    with gr.Blocks(title="我的科研工具箱") as main_app:
        gr.Markdown("# 🛠️ 写作妙妙小工具")
        
        # 使用 Tab 布局来切换不同的工具
        with gr.Tabs():
            
            # --- 工具 1: PDF 智能裁边 ---
            with gr.TabItem("📄 PDF 裁边"):
                pdf_cropper.create_ui()
            
            # --- 工具 2: 文本分析 (示例) ---
            with gr.TabItem("📝 文本统计"):
                text_tools.create_ui()

            # --- 工具 3: 文本比对 ---
            with gr.TabItem("🔍 文本比对"):
                text_diff.create_ui()
                
            # --- 可以在这里继续添加更多 Tab ---
            
    return main_app

if __name__ == "__main__":
    app = create_main_interface()
    
    # 创建一个微调过的 Soft 主题
    # primary_hue="indigo" (靛青色,更有科技感)
    # neutral_hue="slate" (岩灰色,更护眼)
    custom_theme = gr.themes.Soft(
        primary_hue="indigo",
        neutral_hue="slate",
    )
    
    # 注意:在 Gradio 新版本中,theme 参数已移动到 launch() 方法中
    app.launch(inbrowser=True, theme=custom_theme)