This document explains how to test the Paper2Poster API using the provided Python scripts.
A minimal script for quick testing:
# Basic usage
python simple_api_test.py paper.pdf
# Example output:
🎓 Generating poster for: paper.pdf
✅ API is healthy
📤 Uploading PDF and starting generation...
✅ Job started: abc123-def456-789
👀 Monitoring job progress...
📊 Status: processing - Parsing PDF paper...
📊 Status: processing - Generating poster layout...
📊 Status: processing - Generating PowerPoint presentation...
🎉 Generation completed!
💾 Downloading PowerPoint file...
✅ Downloaded: poster_abc123-def456-789.pptx (2,458,123 bytes)
🎉 Success! Poster saved as: poster_abc123-def456-789.pptxA comprehensive script with full control over parameters:
python test_api.py --pdf paper.pdfpython test_api.py \
--pdf paper.pdf \
--model-t 4o \
--model-v 4o \
--width 48 \
--height 36 \
--output-dir ./my_posters \
--poll-interval 5# First start vLLM services
docker-compose --profile vllm up -d
# Then generate with local models
python test_api.py \
--pdf paper.pdf \
--model-t vllm_qwen \
--model-v vllm_qwen_vl# List all jobs
python test_api.py --list-jobs
# Monitor existing job
python test_api.py --job-id abc123-def456-789
# Download files for existing job
python test_api.py --download-only abc123-def456-789-
Start the API service:
docker-compose up -d
-
Install Python dependencies:
pip install requests
-
Verify API is running:
curl http://localhost:6025/health
# Download a sample paper (example)
wget https://arxiv.org/pdf/2301.07041.pdf -O sample_paper.pdf
# Generate poster
python simple_api_test.py sample_paper.pdfpython test_api.py \
--pdf research_paper.pdf \
--model-t 4o \
--model-v 4o \
--width 36 \
--height 24 \
--output-dir ./conference_posters# GPT-4o models
python test_api.py --pdf paper.pdf --model-t 4o --model-v 4o
# Mix of models
python test_api.py --pdf paper.pdf --model-t 4o-mini --model-v 4o
# Local vLLM models (requires vLLM services running)
python test_api.py --pdf paper.pdf --model-t vllm_qwen --model-v vllm_qwen_vl# Disable tree layout
python test_api.py --pdf paper.pdf --ablation-no-tree-layout
# Disable commenter
python test_api.py --pdf paper.pdf --ablation-no-commenter
# Disable examples
python test_api.py --pdf paper.pdf --ablation-no-example| Parameter | Description | Default |
|---|---|---|
--pdf |
Path to PDF paper file | Required |
--api-url |
API base URL | http://localhost:6025 |
--model-t |
Text model name | 4o |
--model-v |
Vision model name | 4o |
--width |
Poster width in inches | 48 |
--height |
Poster height in inches | 36 |
--output-dir |
Output directory | ./downloads |
--poll-interval |
Status check interval (seconds) | 10 |
--no-blank-detection |
Disable blank detection | False |
--ablation-* |
Various ablation study options | False |
4o- GPT-4o4o-mini- GPT-4o Minivllm_qwen- Qwen2.5-7B-Instruct (local)claude-3-5-sonnet- Claude 3.5 Sonnet
4o- GPT-4o Visionvllm_qwen_vl- Qwen2.5-VL-7B-Instruct (local)claude-3-5-sonnet- Claude 3.5 Sonnet
After successful generation, you'll get:
- PowerPoint file (
.pptx) - Editable poster presentation - PNG image (
.png) - Static poster image
-
API Connection Error
❌ Cannot connect to API: Connection refusedSolution: Make sure the API service is running:
docker-compose up -d curl http://localhost:6025/health
-
PDF Upload Error
❌ PDF file not found: paper.pdfSolution: Check the file path and ensure the PDF exists:
ls -la paper.pdf file paper.pdf # Should show "PDF document" -
Job Timeout or Failure
❌ Job failed: OpenAI API key not foundSolution: Check your environment variables:
# Make sure .env file exists with your API keys cat .env | grep API_KEY
-
Model Not Available
❌ Model 'vllm_qwen' not availableSolution: Start the vLLM services:
docker-compose --profile vllm up -d
For more detailed output, you can modify the scripts to add debug information:
import requests
import logging
# Enable debug logging
logging.basicConfig(level=logging.DEBUG)
requests.packages.urllib3.disable_warnings()You can also test the API manually using curl:
# Health check
curl http://localhost:6025/health
# Generate poster
curl -X POST "http://localhost:6025/generate-poster" \
-F "pdf_file=@paper.pdf" \
-F "model_name_t=4o" \
-F "model_name_v=4o"
# Check job status (replace JOB_ID)
curl http://localhost:6025/jobs/JOB_ID
# Download result (replace JOB_ID)
curl -O -J "http://localhost:6025/download/JOB_ID?file_type=pptx"- Generation time: Typically 2-10 minutes depending on paper complexity
- File sizes: PowerPoint files are usually 1-5 MB
- Concurrent jobs: The API supports multiple simultaneous jobs
- Rate limits: Depends on your AI model provider's limits
If you encounter issues:
- Check the API logs:
docker-compose logs paper2poster - Verify your environment configuration
- Ensure all required services are running
- Review the API documentation at http://localhost:6025/docs