custom_toolbox / app.py
MashiroLn's picture
Upload folder using huggingface_hub
bfedf71 verified
raw
history blame
1.35 kB
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)