Spaces:
Sleeping
Sleeping
File size: 1,217 Bytes
d30a68e 4612e99 d30a68e 25406ff d30a68e 39d4462 25406ff |
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 |
---
title: Typst-based PDF generation
emoji: π
colorFrom: green
colorTo: indigo
sdk: docker
pinned: false
short_description: Use a modern document-generator to render PDF files
---
# Generate PDF documents using Gradio and Typst
- minijinja to template a Typst document
- Typst to generate a PDF document
- Gradio to provide a web interface with user parameters (via Components)
- Docker to run the app
## Demo
<img src="./demo.jpeg" width="800">
## Install
Clone the repository:
```shell
git clone https://github.com/egorsmkv/pdf-generator-gradio
cd pdf-generator-gradio
```
Install `typst`:
```shell
cargo install typst-cli
```
## Development
Create virtual environment and install dependencies:
```shell
uv venv --python 3.13
source .venv/bin/activate
uv pip install -r requirements.txt
uv pip install -r requirements-dev.txt
```
## Run
Run Gradio app locally:
```shell
export TYPST_BIN=/home/yehor/.cargo/bin/typst
gradio app.py
```
## Production
Build the Docker image:
```shell
docker build -t pdf-generator-gradio .
```
Run:
```shell
docker run --rm -p 7860:7860 -it pdf-generator-gradio
# Enable Gradio sharing
docker run --rm -p 7860:7860 -e DO_SHARE=y -it pdf-generator-gradio
``` |