File size: 1,864 Bytes
b44ae07
96ec759
b44ae07
 
0aee62c
bfedf71
b44ae07
 
 
 
 
c0f4653
b44ae07
 
 
c0f4653
b44ae07
 
b49cf86
20092ea
b49cf86
96ec759
 
 
 
b49cf86
b44ae07
 
 
 
 
 
bfedf71
4f4e23f
 
 
 
 
 
 
 
 
 
 
 
bfedf71
 
4f4e23f
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
41
42
43
44
45
46
47
48
49
import gradio as gr
from apps import pdf_cropper, text_tools, paper_image_tool, json_editor

def create_main_interface():
    with gr.Blocks(title="我的科研工具箱") as main_app:
        gr.Markdown("# 🛠️ 写作妙妙小工具")
        
        # 使用 Tab 布局来切换不同的工具
        with gr.Tabs():
            
            # --- 工具 1: PDF 智能裁边 ---
            with gr.TabItem("📄 Img2PDF"):
                pdf_cropper.create_ui()
            
            # --- 工具 2: 文本分析 (示例) ---
            with gr.TabItem("📝 Token Stats"):
                text_tools.create_ui()
                
            # --- 工具 3: 科研配图助手 ---
            with gr.TabItem("📑 Image Auto Cropper"):
                paper_image_tool.create_paper_tool()

            # --- 工具 4: JSON 编辑器 ---
            with gr.TabItem("⚡ Fastest JSON Editor"):
                json_editor.create_ui()
            
            # --- 可以在这里继续添加更多 Tab ---
            
    return main_app

if __name__ == "__main__":
    app = create_main_interface()
    
    # custom_theme = gr.themes.Ocean(
    #     primary_hue="emerald",
    #     neutral_hue="gray",
    # ).set(
    #     body_background_fill="#0f172a",  # 深蓝灰背景 (类似 Slate 900)
    #     block_background_fill="#1e293b", # 卡片背景 (类似 Slate 800)
    #     block_border_width="0px",        # 扁平化,去边框
    #     block_shadow="none",             # 扁平化,去阴影
    #     button_primary_background_fill="*primary_600",
    #     button_primary_background_fill_hover="*primary_500",
    #     block_title_text_weight="600",
    # )
    
    # 注意:在 Gradio 新版本中,theme 参数已移动到 launch() 方法中
    app.launch(inbrowser=True)