Spaces:
Running
Running
| import gradio as gr | |
| from apps import pdf_cropper, text_tools | |
| # --- 主程序入口 --- | |
| # 这里是“应用集市”的容器。 | |
| # 每次添加新工具,只需要 import 进来,并在 tab_list 中注册即可。 | |
| 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() | |
| # --- 可以在这里继续添加更多 Tab --- | |
| return main_app | |
| if __name__ == "__main__": | |
| app = create_main_interface() | |
| app.launch(inbrowser=True) | |