--- title: AI Research Paper Analyst emoji: 🔬 colorFrom: blue colorTo: indigo sdk: gradio python_version: "3.10" app_file: app.py pinned: false license: mit --- # 🔬 AI Research Paper Analyst Automated Peer-Review System powered by Multi-Agent AI (CrewAI + GPT-4o). ## 🚀 Features - **Multi-Agent Pipeline**: 7 agents (1 safety gate + 6 analysis) review methodology, novelty, and quality. - **Programmatic Safety**: Deterministic guardrails for PII redaction, prompt injection detection, and malicious URL blocking (regex/logic-based — no LLM). - **Structured Output**: All agent outputs enforced via Pydantic schemas. - **15-Point Rubric**: Binary quality scoring with automatic enhancement for failed criteria. - **Interactive UI**: Gradio interface with 6 tabs, real-time progress tracking, and report export. ## 🛠️ Agents 1. **Safety Guardian** — Programmatic gate that blocks unsafe documents (no LLM). 2. **Paper Extractor** (GPT-4o) — Structures raw text into metadata, methodology, findings. 3. **Methodology Critic** (GPT-4o-mini) — Evaluates study design, reproducibility, bias risks. 4. **Relevance Researcher** (GPT-4o-mini) — Checks novelty via Semantic Scholar / OpenAlex. 5. **Review Synthesizer** (GPT-4o-mini) — Drafts the initial peer-review report. 6. **Rubric Evaluator** (GPT-4o-mini) — Scores against 15 strict binary criteria. 7. **Enhancer** (GPT-4o-mini) — Polishes the final output into a publication-ready report. ## 🔧 Tools | Tool | Purpose | |---|---| | `pdf_parser` | Extract text from PDF (pdfplumber) | | `pii_detector` | Detect & redact PII (emails, SSNs, phones, credit cards) | | `injection_scanner` | Detect 9 prompt-injection patterns | | `url_validator` | Blocklist check for malicious URLs | | `citation_search` | Search Semantic Scholar / OpenAlex for related papers | ## 📚 How to Use ### Prerequisites - Python 3.10+ - OpenAI API key with GPT-4o access ### Setup & Run ```bash # 1. Install dependencies pip install -r requirements.txt # 2. Create .env file with your API key echo "OPENAI_API_KEY=your-key-here" > .env # 3. Launch the app python app.py ``` Open **http://localhost:7860** in your browser, upload a PDF, and click **"Analyze Paper"**. ### On HuggingFace Spaces Add `OPENAI_API_KEY` as a **Secret** in Space Settings. ## 📁 Project Structure ``` ├── app.py # Main pipeline + Gradio UI ├── agents/ # 6 CrewAI agent definitions ├── tools/ # 5 custom tool implementations ├── schemas/models.py # 8 Pydantic output schemas ├── requirements.txt # Python dependencies ├── walkthrough.md # Detailed project walkthrough └── PROJECT_DOCUMENTATION.md # Full technical documentation ``` ## 🔑 Environment Variables | Variable | Required | Purpose | |---|---|---| | `OPENAI_API_KEY` | Yes | OpenAI API access (GPT-4o required) | --- *Homework 5 — Agentic AI Bootcamp*