File size: 4,390 Bytes
1129023
 
 
 
 
 
 
 
 
 
 
a7f3368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
title: MangakAI
emoji: πŸ“š
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: "5.44.1"
app_file: app.py
pinned: false
---

# MangakAI πŸ“šβœ¨

Transform your stories into stunning manga panels with AI! MangakAI is an intelligent manga generation tool that converts written narratives into visual manga-style panels using Google's Gemini AI models.

## 🌟 Features

- **🎨 AI-Powered Generation**: Convert stories into professional manga panels with scene intelligence
- **🎭 Style Customization**: Multiple art styles, moods, color palettes, and composition options
- **πŸ”„ Panel Management**: Regenerate specific panels with custom modifications and reference images
- **πŸ“‹ Custom Templates**: Upload your own panel layouts for personalized manga creation
- **πŸ“ Export Options**: Generate PDFs and organize panels with version control
- **πŸ–₯️ Web Interface**: User-friendly Gradio interface with text/file input and example stories

## πŸš€ Quick Start

### Prerequisites
- Python 3.11 or higher
- Google Gemini API key
- UV package manager (recommended) or pip

### Installation

1. **Clone the repository**
   ```bash
   git clone https://github.com/Shiva4113/MangakAI.git
   cd MangakAI
   ```

2. **Install dependencies**
   ```bash
   # Using UV (recommended)
   uv sync
   ```

3. **Set up environment variables**
   ```bash
   # Create .env file
   echo "GEMINI_API_KEY=your_gemini_api_key_here" > .env
   ```

4. **Run the application**
   ```bash
   uv run app.py
   ```

5. **Access the interface**
   Open your browser and navigate to `http://localhost:7860`

## πŸ“– Usage Guide

### πŸ–‹οΈ **Generate Manga from Text**

1. Enter your story in the text area
2. Select number of scenes (1-10 panels)
3. Choose style preferences (optional)
4. Upload custom template (optional)
5. Click "Generate Manga"

### πŸ“„ **Generate from File**

1. Upload a .txt story file
2. Configure settings and generate

### πŸ”„ **Regenerate Panels**

1. Select panel number to modify
2. Enter modification instructions
3. Upload reference image (optional)
4. Choose to replace original or keep both

### πŸ“₯ **Export as PDF**

1. Generate your manga first
2. Go to "Download PDF" tab and click "Create PDF"

## πŸ—οΈ Project Structure

```
MangakAI/
β”œβ”€β”€ app.py              # Main Gradio interface
β”œβ”€β”€ manga.py            # Core manga generation logic
β”œβ”€β”€ utils.py            # Utility functions and prompts
β”œβ”€β”€ main.py             # Entry point
β”œβ”€β”€ pyproject.toml      # Project configuration
β”œβ”€β”€ .env               # Environment variables (create this)
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ examples/      # Example manga panels
β”‚   β”‚   β”œβ”€β”€ LittleLantern/
β”‚   β”‚   β”œβ”€β”€ PaperKite/
β”‚   β”‚   └── StrayPuppy/
β”‚   β”œβ”€β”€ output/        # Generated manga panels
β”‚   β”œβ”€β”€ stories/       # Story text files
β”‚   └── templates/     # Panel templates
└── README.md
```

## πŸ› οΈ Configuration

### Environment Variables

Create a `.env` file with the following variables:

```env
GEMINI_API_KEY=your_gemini_api_key_here
TEMPLATE_PATH=data/templates/template1.png
OUTPUT_DIR=data/output
STORIES_DIR=data/stories
IMAGE_MODEL_NAME=gemini-2.5-flash-image-preview
SCENE_MODEL_NAME=gemini-2.0-flash
```

### API Setup

1. **Get Gemini API Key**:
   - Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
   - Create a new API key
   - Add it to your `.env` file

## 🎨 Style Options

Choose from various art styles (Traditional Manga, Shonen, Shoujo, Seinen, Chibi, Cyberpunk, Fantasy, Horror), moods (Epic, Dark, Light, Dramatic, Action-packed), color palettes, character styles, and composition options to create your unique manga aesthetic.

## πŸ”§ Advanced Features

- **Smart Prompts**: Analyzes story structure and maintains character consistency
- **Custom Templates**: Upload your own panel layouts with automatic AI adaptation
- **Reference Images**: Guide style, composition, and character appearance

## πŸ“‹ Examples

The project includes three example stories with generated panels:

1. **The Little Lantern**: A heartwarming tale of courage and kindness
2. **The Paper Kite**: A story about letting go and finding wonder
3. **The Stray Puppy**: A touching story of compassion and friendship



*Transform your imagination into visual stories with the power of AI!*