A modern web application that transforms academic papers into engaging blog posts using AI. Paper2Blog leverages advanced language and vision models to create accessible, well-structured blog content while maintaining academic accuracy.
- PDF Processing: Upload academic papers in PDF format
- Intelligent Content Generation: Converts academic content into engaging blog posts
- Image Handling: Automatically extracts and captions figures from papers
- Bilingual Support: Generate content in English or Chinese
- Modern UI: Clean, responsive interface with Material-UI components
- Markdown Output: Well-formatted blog posts with proper image placement
- Framework: FastAPI
- Language Models: OpenAI GPT-4
- PDF Processing: PyPDF2
- Vision Processing: Transformers
- Language: Python 3.11+
- Framework: React
- UI Library: Material-UI (MUI)
- File Upload: react-dropzone
- Markdown Rendering: react-markdown
- Styling: CSS-in-JS with MUI theme
# Clone the repository
git clone https://github.com/pprp/paper2blog.git
cd paper2blog
# Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package in development mode
pip install -e ".[dev]"
pip install paper2blog
-
Install Development Dependencies
pip install -e ".[dev]"
-
Run Tests
pytest
-
Code Formatting
# Format code black . # Sort imports isort . # Check style flake8
-
Clone the Repository
git clone https://github.com/yourusername/Paper2Blog.git cd Paper2Blog
-
Backend Setup
# Create and activate virtual environment python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate # Install dependencies pip install -r requirements.txt # Set up environment variables cp .env.example .env # Edit .env with your OpenAI API key and other settings OPENAI_API_KEY=** OPENAI_API_BASE=** OPEN_MODEL=gpt-4o-mini
-
Frontend Setup
cd frontend npm install
-
Start the Application
# Terminal 1: Start backend server uvicorn main:app --reload # Terminal 2: Start frontend development server cd frontend npm start
-
Access the Application
- Open http://localhost:3000 in your browser
-
Marker Server
- Start the marker server with
marker_server --port 8024
- Start the marker server with
Create a .env
file with the following variables:
OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE=https://api.openai.com/v1 # Or your custom API endpoint
-
Upload Paper
- Drag and drop a PDF file or click to select
- Alternatively, paste a URL to the paper
-
Select Language
- Choose between English and Chinese for the output
-
Generate Blog
- Click "Convert" to process the paper
- The app will generate a blog post with:
- Engaging title
- Well-structured content
- Properly placed figures with captions
- Summary section
- Relevant tags
-
Export
- Copy the generated markdown
- Use in your preferred blogging platform
Paper2Blog/
├── frontend/ # React frontend
│ ├── src/
│ │ ├── App.js # Main application component
│ │ └── index.css # Global styles
├── paper2blog/ # Backend modules
│ ├── __init__.py
│ ├── llm_handler.py # LLM integration
│ └── models.py # Data models
├── main.py # FastAPI application
├── requirements.txt # Python dependencies
└── .env # Environment variables
- Backend: Add new endpoints in
main.py
- LLM: Modify prompts in
llm_handler.py
- Frontend: Update components in
frontend/src
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for GPT models
- Hugging Face for Transformers
- FastAPI team
- React and Material-UI communities