### Minimal Setup for Running Paper2Any Source: https://github.com/opendcai/paper2any/blob/main/docs/index.md This snippet shows the minimal commands required to set up and start the Paper2Any application. It involves copying example environment files and then executing a start script. ```bash cp fastapi_app/.env.example fastapi_app/.env cp frontend-workflow/.env.example frontend-workflow/.env bash deploy/start_nv.sh ``` -------------------------------- ### Copy Example Configuration Files Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/configuration.md Copy the example configuration files to their respective locations. The simple mode is recommended for initial setup. ```bash cp fastapi_app/.env.simple.example fastapi_app/.env cp frontend-workflow/.env.simple.example frontend-workflow/.env cp deploy/profiles/nv.env.example deploy/profiles/nv.env ``` -------------------------------- ### Deploy NVIDIA Machine Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Copy the example NVIDIA machine environment file and start the deployment script. ```bash cp deploy/profiles/nv.env.example deploy/profiles/nv.env bash deploy/start_nv.sh ``` -------------------------------- ### Frontend Installation with npm Source: https://github.com/opendcai/paper2any/blob/main/docs/installation.md Navigates to the frontend directory and installs its dependencies using npm ci. Ensure Node.js and npm are installed and compatible. ```bash cd frontend-workflow npm ci cd .. ``` -------------------------------- ### Copy Backend Environment Example Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Copy the example backend environment file to create a new one for configuration. ```bash cp fastapi_app/.env.example fastapi_app/.env ``` -------------------------------- ### Start Backend Service Only Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Source the NVIDIA machine environment variables and then start the backend service. ```bash set -a source deploy/profiles/nv.env set +a bash deploy/start.sh ``` -------------------------------- ### Backend Installation with Conda and Pip Source: https://github.com/opendcai/paper2any/blob/main/docs/installation.md Sets up the Python environment for the backend using conda, activates it, and installs project dependencies. Includes optional installation for NVIDIA GPU support and editable install. ```bash conda create -n paper2any python=3.11 -y conda activate paper2any pip install --upgrade pip pip install -r requirements-paper.txt ``` ```bash # NVIDIA GPU 机器再额外安装 pip install -r requirements-cu12.txt ``` ```bash pip install -e . ``` -------------------------------- ### Copy Frontend Environment Example Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Copy the example frontend environment file to create a new one for configuration. ```bash cp frontend-workflow/.env.example frontend-workflow/.env ``` -------------------------------- ### Start Muxi Machine Deployment Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Execute the script to start the deployment on a Muxi machine. ```bash bash deploy/start_muxi.sh ``` -------------------------------- ### Linux Installation: Clone Repository and Install Base Dependencies Source: https://github.com/opendcai/paper2any/blob/main/README.md Clones the Paper2Any repository and installs the base Python dependencies from requirements-base.txt. Also installs the project in editable mode. ```bash # 1. Clone repository git clone https://github.com/OpenDCAI/Paper2Any.git cd Paper2Any # 2. Install base dependencies pip install -r requirements-base.txt # 3. Install in editable (dev) mode pip install -e . ``` -------------------------------- ### Copy Example .env Files Source: https://github.com/opendcai/paper2any/blob/main/README.md Copy the example environment files to create your own configuration files for the backend and frontend applications. These files are optional. ```bash # Copy backend environment file cp fastapi_app/.env.example fastapi_app/.env # Copy frontend environment file cp frontend-workflow/.env.example frontend-workflow/.env ``` -------------------------------- ### Install Ubuntu/Debian System Packages Source: https://github.com/opendcai/paper2any/blob/main/requirements-system-ubuntu.txt Installs system packages listed in `requirements-system-ubuntu.txt` using `apt-get`. Ensure you run `apt-get update` first. ```bash sudo apt-get update sudo apt-get install -y $(grep -v '^#' requirements-system-ubuntu.txt | tr '\n' ' ') ``` -------------------------------- ### Copy Deployment Profile Examples Source: https://github.com/opendcai/paper2any/blob/main/deploy/profiles/README.md Use these commands to copy example deployment profiles to local configuration files. Only fill in values your machine requires; empty values trigger auto-discovery. ```bash cp deploy/profiles/muxi.env.example deploy/profiles/muxi.env ``` ```bash cp deploy/profiles/nv.env.example deploy/profiles/nv.env ``` -------------------------------- ### Run Frontend with npm Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md Start the frontend development server using npm. Ensure you are in the correct directory and specify host and port. ```bash cd frontend-workflow npm run dev -- --host 0.0.0.0 --port 3000 ``` -------------------------------- ### Start Frontend Service Only Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Execute the script to start only the frontend service. ```bash bash deploy/start_frontend.sh ``` -------------------------------- ### Linux Installation: Install System Dependencies (Ubuntu) Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs essential system packages on Ubuntu, including ffmpeg, inkscape, libreoffice, poppler-utils, and wkhtmltopdf. These are external tools not installed by pip. ```bash # 5. System dependencies (Ubuntu example; full list is mirrored in requirements-system-ubuntu.txt) sudo apt-get update sudo apt-get install -y ffmpeg inkscape libreoffice poppler-utils wkhtmltopdf ``` -------------------------------- ### Start Local SAM3 Development Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md Use this script for single-machine development, which starts a SAM3 service, backend, and frontend. It's suitable for local debugging. ```bash bash script/start_local_sam3_dev.sh ``` -------------------------------- ### Create Conda Environment and Install Base Dependencies Source: https://github.com/opendcai/paper2any/blob/main/README.md Sets up a new conda environment for Paper2Any and installs the core Python dependencies required for Windows. ```bash # 0. Create and activate a conda environment conda create -n paper2any python=3.12 -y conda activate paper2any # 1. Clone repository git clone https://github.com/OpenDCAI/Paper2Any.git cd Paper2Any # 2. Install base dependencies pip install -r requirements-win-base.txt # 3. Install in editable (dev) mode pip install -e . ``` -------------------------------- ### Build and Run Docker Containers Source: https://github.com/opendcai/paper2any/blob/main/README.md Builds and starts the backend and frontend Docker containers. Rebuild if code or .env files are changed. ```bash # 3. Build + run bash deploy/docker-up.sh ``` -------------------------------- ### Run Backend with Uvicorn Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md Directly start the backend service using Uvicorn for development without deployment scripts. Ensure .env and dependencies are prepared. ```bash uvicorn fastapi_app.main:app --host 0.0.0.0 --port 8000 ``` -------------------------------- ### Copy Muxi Machine Deployment Configuration Source: https://github.com/opendcai/paper2any/blob/main/DEPLOY.md Copy the example Muxi machine environment file to create a new one for machine-specific parameters. ```bash cp deploy/profiles/muxi.env.example deploy/profiles/muxi.env ``` -------------------------------- ### Start Local Model Service Cluster Source: https://github.com/opendcai/paper2any/blob/main/README.md Use this script to start a local model service cluster for MinerU, SAM3, and OCR in a high-concurrency environment. Modify gpu_id and instance count as needed. ```bash bash script/start_model_servers.sh ``` -------------------------------- ### Launch Paper2Any Web Frontend Source: https://github.com/opendcai/paper2any/blob/main/README.md Starts the Paper2Any web application using a one-click entrypoint script, recommended for NVIDIA machines. The frontend will be accessible at http://localhost:3000. ```bash # Recommended one-click entrypoint on NVIDIA machines bash deploy/start_nv.sh ``` -------------------------------- ### Linux Installation: Resolve Dependency Conflicts Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs the doclayout_yolo package without its dependencies to avoid potential conflicts with other project requirements. ```bash # 4. Resolve doclayout_yolo dependency conflicts (Important) pip install doclayout_yolo --no-deps ``` -------------------------------- ### Install vLLM for Local Inference Acceleration Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs a specific Windows build of vLLM for optional local inference acceleration. Ensure the wheel file matches your Python version, platform, and CUDA toolkit version. ```bash pip install vllm-0.11.0+cu124-cp312-cp312-win_amd64.whl ``` -------------------------------- ### Clone Paper2Any Repository and Configure Environment Source: https://github.com/opendcai/paper2any/blob/main/README.md Clone the Paper2Any repository and set up the initial environment variables for Docker deployment. This includes copying example configuration files. ```bash # 1. Clone git clone https://github.com/OpenDCAI/Paper2Any.git cd Paper2Any # 2. Configure environment variables cp fastapi_app/.env.simple.example fastapi_app/.env cp frontend-workflow/.env.simple.example frontend-workflow/.env cp deploy/docker.env.example deploy/docker.env ``` -------------------------------- ### Install System Dependencies on Linux Source: https://github.com/opendcai/paper2any/blob/main/docs/installation.md Installs essential system packages required for various project functionalities, including graphics export and document conversion. Ensure you are in a Linux environment. ```bash sudo apt-get update sudo apt-get install -y \ build-essential \ curl \ ffmpeg \ git \ inkscape \ libreoffice \ poppler-utils \ wget \ libgl1 \ libglib2.0-0 \ libgomp1 \ libsm6 \ libxext6 \ libxrender1 \ libsndfile1 ``` -------------------------------- ### Start Local SAM3 Service with Docker Source: https://github.com/opendcai/paper2any/blob/main/README.md Starts the optional local SAM3 segmentation service using Docker Compose. This is required for PDF2PPT, Image2PPT, and Image2Drawio functionalities if not pointing to an external SAM3 service. ```bash DOCKER_WITH_SAM3=1 bash deploy/docker-up.sh ``` -------------------------------- ### Configure Environment Variables for Paper2Any Source: https://github.com/opendcai/paper2any/blob/main/README.md Copy example environment files to active configuration files for simple or advanced modes. This is a necessary step before running the application. ```bash cp fastapi_app/.env.simple.example fastapi_app/.env cp frontend-workflow/.env.simple.example frontend-workflow/.env ``` ```bash cp fastapi_app/.env.example fastapi_app/.env cp frontend-workflow/.env.example frontend-workflow/.env ``` -------------------------------- ### Load MinerU Pre-trained Model with vLLM Source: https://github.com/opendcai/paper2any/blob/main/README.md Starts a vLLM server to load the MinerU pre-trained model, specifying host, port, logits processor, and GPU memory utilization. This command is intended for PowerShell. ```powershell # Start in PowerShell vllm serve opendatalab/MinerU2.5-2509-1.2B \ --host 127.0.0.1 \ --port 8010 \ --logits-processors mineru_vl_utils:MinerULogitsProcessor \ --gpu-memory-utilization 0.6 \ --trust-remote-code \ --enforce-eager ``` -------------------------------- ### Linux Installation: Install LaTeX Engine Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs the Tectonic LaTeX engine using Conda, which is recommended for LaTeX rendering. ```bash # 3. LaTeX engine (tectonic) - recommended via conda conda install -c conda-forge tectonic -y ``` -------------------------------- ### Linux Installation: Install Paper-Specific Dependencies Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs Python dependencies required for paper processing, PDF/figure handling, and NVIDIA CUDA 12 extras (Linux only). ```bash # 1. Paper / PDF / figure Python extras pip install -r requirements-paper.txt # 2. NVIDIA GPU runtime extras (Linux + CUDA 12 only) pip install -r requirements-cu12.txt ``` -------------------------------- ### Prepare Local Models Source: https://github.com/opendcai/paper2any/blob/main/models/README.md Run this script to populate the local models directory with necessary files. Ensure you have the script available in the 'script' directory. ```bash bash script/prepare_local_models.sh ``` -------------------------------- ### Install Paper2Any-Specific Dependencies Source: https://github.com/opendcai/paper2any/blob/main/README.md Installs additional Python packages for LaTeX rendering and vector graphics processing, and configures the Tectonic LaTeX engine via conda. ```bash # Python dependencies pip install -r requirements-paper.txt # tectonic: LaTeX engine (recommended via conda) conda install -c conda-forge tectonic -y ``` -------------------------------- ### Beautify PPT (Basic) Source: https://github.com/opendcai/paper2any/blob/main/README.md Perform basic beautification on an existing PowerPoint file. Requires the input PPTX file, a style description, and an API key. ```bash python script/run_ppt2polish_cli.py \ --input old_presentation.pptx \ --style "Academic style, clean and elegant" \ --api-key sk-xxx ``` -------------------------------- ### Frontend API Key and Base URL Configuration Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/configuration.md Configure frontend settings such as the API key, base URL, and Supabase connection details. ```bash VITE_API_KEY= VITE_API_BASE_URL= VITE_SUPABASE_URL= VITE_SUPABASE_ANON_KEY= ``` -------------------------------- ### Show Help Message Source: https://github.com/opendcai/paper2any/blob/main/README.md Display detailed help and usage information for any of the CLI scripts. This is useful for understanding all available options and parameters. ```bash python script/run_paper2figure_cli.py --help ``` -------------------------------- ### Build Docker Images Only Source: https://github.com/opendcai/paper2any/blob/main/README.md Builds the Docker images without starting the containers. ```bash bash deploy/docker-build.sh ``` -------------------------------- ### Backend API Key and Billing Mode Configuration Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/configuration.md Configure essential backend settings including the API key, billing mode, and third-party API URLs. ```bash BACKEND_API_KEY= APP_BILLING_MODE= DF_API_URL= DF_API_KEY= SUPABASE_URL= SUPABASE_ANON_KEY= SUPABASE_SERVICE_ROLE_KEY= ``` -------------------------------- ### Docker Compose Configuration Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md docker-compose.yml file for orchestrating backend and frontend containers. Note that it does not automatically start SAM3/OCR clusters. ```yaml docker-compose.yml ``` -------------------------------- ### Configure Backend .env for Service Integration Source: https://github.com/opendcai/paper2any/blob/main/README.md Configure external or local services like DrawIO OCR, MinerU, and SAM3 segmentation in the backend .env file. MinerU can fall back to a local port if the API key is empty. ```bash # DrawIO OCR / VLM PAPER2DRAWIO_OCR_API_URL=https://dashscope.aliyuncs.com/compatible-mode/v1 PAPER2DRAWIO_OCR_API_KEY=your_dashscope_key # MinerU official remote API; if MINERU_API_KEY is empty, backend falls back to local MINERU_PORT MINERU_API_BASE_URL=https://mineru.net/api/v4 MINERU_API_KEY=your_mineru_api_key MINERU_API_MODEL_VERSION=vlm # SAM3 segmentation service for PDF2PPT / Image2PPT / Image2Drawio # One endpoint: SAM3_SERVER_URLS=http://127.0.0.1:8001 # Or multiple endpoints for load balancing: # SAM3_SERVER_URLS=http://127.0.0.1:8021,http://127.0.0.1:8022 ``` -------------------------------- ### Beautify PPT (with Reference Image) Source: https://github.com/opendcai/paper2any/blob/main/README.md Beautify an existing PowerPoint file using a reference image for style consistency. Requires the input PPTX, a style description, the reference image, and an API key. ```bash python script/run_ppt2polish_cli.py \ --input old_presentation.pptx \ --style "Modern minimalist style" \ --ref-img reference_style.png \ --api-key sk-xxx ``` -------------------------------- ### Run Paper2Drawio SAM3 Test Source: https://github.com/opendcai/paper2any/blob/main/tests/_archive/manual/README.md Execute the visual drawio workflow test for SAM3. This command is an example of how to run a specific manual test script. ```bash python tests/_archive/manual/sam3/test_paper2drawio_sam3_back.py ``` -------------------------------- ### Configure Frontend .env for Supabase Source: https://github.com/opendcai/paper2any/blob/main/README.md Uncomment and configure Supabase URL and anon key in the frontend .env file if you want to enable user authentication features. ```bash VITE_SUPABASE_URL=https://your-project.supabase.co VITE_SUPABASE_ANON_KEY=your-anon-key ``` -------------------------------- ### Prepare Local Models Source: https://github.com/opendcai/paper2any/blob/main/docs/installation.md A script to organize directories and download the RMBG-2.0 model. It does not automatically download the full SAM3 checkpoint or source code. ```bash script/prepare_local_models.sh ``` -------------------------------- ### Linux Installation: Create Conda Environment Source: https://github.com/opendcai/paper2any/blob/main/README.md Creates and activates a new Conda environment named 'paper2any' with Python 3.11. This isolates project dependencies. ```bash # 0. Create and activate a conda environment conda create -n paper2any python=3.11 -y conda activate paper2any ``` -------------------------------- ### Deployment Profile Configuration Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/configuration.md Configure deployment-specific parameters like Python paths, ports, and model server enablement. ```bash APP_PYTHON= PAPER2ANY_PYTHON= APP_PORT=8000 FRONTEND_PORT=3000 SAM3_ENABLED=1 SAM3_GPUS= ``` -------------------------------- ### Configure Backend .env for Supabase Source: https://github.com/opendcai/paper2any/blob/main/README.md Configure Supabase credentials in the backend .env file if you require user authentication and cloud storage. This is optional. ```bash SUPABASE_URL=https://your-project-id.supabase.co SUPABASE_ANON_KEY=your_supabase_anon_key ``` -------------------------------- ### Current Story Board JSON Example Source: https://github.com/opendcai/paper2any/blob/main/dataflow_agent/toolkits/postertool/config/prompts/layout_balancer.txt This JSON represents the current state of a poster's storyboard, detailing the arrangement of sections within each column, their content, and utilization. ```json { "current_story_board": { "column_1": { "sections": ["intro_motivation", "related_work"], "utilization": "75%" }, "column_2": { "sections": ["method_algorithm_a", "implementation_details"], "utilization": "90%" }, "column_3": { "sections": ["results_summary", "conclusion"], "utilization": "98%" } } } ``` -------------------------------- ### Verify Runtime Configuration Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md Check the runtime configuration of the backend by sending a request to the /api/v1/account/runtime-config endpoint with an API key. ```bash curl -H "X-API-Key: your-backend-api-key" \ http://127.0.0.1:8000/api/v1/account/runtime-config ``` -------------------------------- ### Column Analysis JSON Example Source: https://github.com/opendcai/paper2any/blob/main/dataflow_agent/toolkits/postertool/config/prompts/layout_balancer.txt This JSON provides an analysis of each column's current status, including its utilization percentage and a qualitative status (e.g., 'underutilized', 'optimal', 'overflow'). ```json { "column_analysis": { "left_utilization": "75%", "left_status": "underutilized", "middle_utilization": "90%", "middle_status": "optimal", "right_utilization": "98%", "right_status": "overflow", "available_height": "30 inches", "target_utilization": "85-95%" } } ``` -------------------------------- ### View Backend Logs Source: https://github.com/opendcai/paper2any/blob/main/docs/guides/open_source_deployment.md Execute a script to view the backend application logs. ```bash bash deploy/logs.sh app ``` -------------------------------- ### Structured Sections JSON Example Source: https://github.com/opendcai/paper2any/blob/main/dataflow_agent/toolkits/postertool/config/prompts/layout_balancer.txt This JSON structure represents available sections that can be added to a poster column. It includes details like section ID, title, content, importance level, and associated visual assets. ```json { "structured_sections": [ { "section_id": "intro_motivation", "section_title": "Motivation", "content": "The increasing complexity of modern systems necessitates novel approaches to resource management.", "importance_level": 2, "visual_assets": [] }, { "section_id": "method_algorithm_a", "section_title": "Algorithm A", "content": "Algorithm A employs a greedy approach to optimize task scheduling.", "importance_level": 1, "visual_assets": ["fig_algo_a.png"] } ] } ``` -------------------------------- ### Convert Paper to PPT Presentation (Basic) Source: https://github.com/opendcai/paper2any/blob/main/README.md Basic usage for converting a PDF paper into a PowerPoint presentation. Requires an input PDF and an API key. ```bash python script/run_paper2ppt_cli.py \ --input paper.pdf \ --api-key sk-xxx \ --page-count 15 ``` -------------------------------- ### Convert Image to PPT (Basic) Source: https://github.com/opendcai/paper2any/blob/main/README.md Convert an image file into an editable PowerPoint presentation. Requires an input image file. ```bash python script/run_image2ppt_cli.py --input screenshot.png ```