custom_toolbox / app.py
MashiroLn's picture
Upload folder using huggingface_hub
96ec759 verified
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)