File size: 3,402 Bytes
98cda7c
63de3ab
 
 
 
98cda7c
63de3ab
98cda7c
63de3ab
98cda7c
 
63de3ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
title: Blog-Writing-Agent
emoji: πŸŽ“
colorFrom: blue
colorTo: green
sdk: docker
app_file: main.py
pinned: false
short_description: This is the Agentic Blog Writing Agent
---

# ✍️ Bloggig - AI Blog Writing Agent

Bloggig is a sophisticated AI-powered agent designed to transform a single topic into a professional, research-backed blog post complete with AI-generated visuals. Built with **LangGraph** and **FastAPI**, it orchestrates a complex pipeline of research, planning, writing, and image generation to deliver high-quality content in real-time.

![Bloggig Preview](graph.png)

## πŸš€ Key Features

- **🌐 Autonomous Research**: Integrates with Tavily AI to perform deep web searches and gather factual evidence.
- **πŸ“‹ Intelligent Planning**: Generates structured blog plans tailored to specific audiences and tones.
- **✍️ Parallel Writing Pipeline**: Uses a worker-reducer architecture to generate multiple blog sections simultaneously for maximum efficiency.
- **🎨 AI-Generated Visuals**: Automatically plans and generates relevant images using **Stable Diffusion XL** (via Hugging Face Inference).
- **πŸ’» Modern ChatGPT-like UI**: A sleek, dark-themed dashboard featuring:
  - **Real-time Streaming**: Watch the AI's "thought process" and pipeline progression via WebSockets.
  - **Markdown Rendering**: Beautifully formatted blog previews with syntax highlighting.
  - **History Management**: Browse, view, and manage previously generated blogs.
- **πŸ“¦ Export & Management**:
  - **Download as ZIP**: Get the full markdown file along with all generated image assets.
  - **Clean Deletion**: Permanent removal of blogs and their associated images with a single click.

## πŸ› οΈ Tech Stack

- **Backend**: FastAPI, LangGraph, Pydantic, Uvicorn.
- **AI Models**: Bedrock Converse API (LLM), Stable Diffusion XL (Images).
- **Search Engine**: Tavily AI.
- **Frontend**: Semantic HTML5, Vanilla CSS (Glassmorphism), Marked.js, Highlight.js.
- **Tools**: UV (Python package manager), Git.

## βš™οΈ Installation & Setup

### 1. Clone the Repository

```bash
git clone https://github.com/VashuTheGreat/Blog-Writing-Agent.git
cd Blog-Writing-Agent
```

### 2. Install Dependencies

Using `uv` (recommended):

```bash
uv sync
```

Or using `pip`:

```bash
pip install -r requirements.txt
```

### 3. Environment Variables

Create a `.env` file in the root directory and add your credentials:

```env
HF_TOKEN=your_huggingface_token
TAVILY_API_KEY=your_tavily_api_key
AWS_ACCESS_KEY_ID=your_aws_key
AWS_SECRET_ACCESS_KEY=your_aws_secret
AWS_REGION=your_aws_region
```

## πŸƒ Running the Application

Start the FastAPI server:

```bash
python Application/app.py
```

The application will be available at `http://localhost:8000`.

## πŸ“‚ Project Structure

- `Application/`: Contains the web server (`app.py`) and the frontend (`index.html`).
- `src/graph/`: Core LangGraph implementation (nodes, edges, and logic).
- `src/components/`: External integrations (Tavily search, Image generation).
- `src/models/`: Pydantic models for state management and structured output.
- `results/`: Directory where generated markdown blogs are saved.
- `images/`: Directory where generated images are stored.
- `src/utils/`: Utility functions (e.g., blog deletion logic).

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.