File size: 1,940 Bytes
4c9b2e2
 
f48fe4d
4c9b2e2
f48fe4d
4c9b2e2
c68439e
4c9b2e2
 
f48fe4d
4c9b2e2
 
f48fe4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c68439e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Maze Generator
emoji: 🎯
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.46.1
app_file: app.py
pinned: false
license: mit
---

# Maze Generator

A Gradio web interface that generates custom maze PDFs from https://www.mazegenerator.net/ with customizable dimensions and quantities.

## Features

- Generate multiple maze PDFs with specified dimensions
- Extract only the first page from each PDF (to remove solution pages)
- Web interface with progress tracking
- Merge multiple PDFs into a single file
- Real-time file list updates

## How to Use

1. **Generate Mazes Tab:**
   - Set the number of mazes you want to generate (1-50)
   - Specify width and height in cells (2-200)
   - Click "Generate Mazes" to create the PDFs
   - View generated files in the file list

2. **Merge PDFs Tab:**
   - Click "Merge All PDFs" to combine all PDFs in the pdfs/ directory
   - The merged file will be saved as `merged_mazes.pdf`
   - Individual files will be deleted after merging

## Technical Details

- Each maze is generated with random patterns
- PDFs are saved in the `pdfs/` directory
- File naming pattern: `maze_{width}x{height}_{number}.pdf`
- The app automatically handles file name conflicts by incrementing numbers

## Dependencies

- `gradio`: Web interface framework
- `pandas`: Data manipulation
- `pypdf`: PDF processing and merging
- `requests`: HTTP requests to maze generator API

## Deployment

This app is designed to be deployed on Hugging Face Spaces. The deployment configuration is specified in the front matter of this README.md file.

## Local Development

To run this app locally:

1. Clone the repository
2. Create a virtual environment: `python -m venv venv`
3. Activate the environment: `source venv/bin/activate` (Linux/Mac) or `venv\Scripts\activate` (Windows)
4. Install dependencies: `pip install -e .`
5. Run the app: `python app.py`

The app will be available at `http://localhost:7861`