File size: 3,872 Bytes
571b640
 
 
 
 
 
 
 
 
0dd5d28
 
5e7afcf
0dd5d28
5e7afcf
0dd5d28
 
 
 
 
 
 
 
 
 
5e7afcf
0dd5d28
 
5e7afcf
 
 
 
 
 
 
 
 
0dd5d28
 
5e7afcf
0dd5d28
ff7e103
 
5e7afcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: README
emoji: πŸ“š
colorFrom: red
colorTo: indigo
sdk: static
pinned: false
---

# UV Scripts

**Ready-to-run ML tools powered by UV - zero setup, maximum power**

Run state-of-the-art ML workflows with a single command. From OCR to classification, all scripts work instantly with `uv run`.

## What are UV scripts?

UV scripts are self-contained Python scripts that use [inline metadata](https://docs.astral.sh/uv/guides/scripts/) to specify dependencies. Just `uv run script.py` and everything installs automatically.

Perfect for:
- πŸš€ **GPU workflows** on [HF Jobs](https://huggingface.co/docs/hub/spaces-gpu-jobs)
- πŸ’» **Local processing** on your machine  
- πŸ”„ **Reproducible pipelines** that work anywhere

## πŸš€ Quick Example

```bash
# Extract text from images with state-of-the-art OCR
uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \
  your-image-dataset \
  your-extracted-text

# Or run on GPU with HF Jobs (no local GPU needed!)
hf jobs uv run --flavor l4x1 \
  https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \
  your-images your-text
```

## πŸ“š Browse Scripts

| Script Collection | Description | GPU Required |
|-------------------|-------------|--------------|
| [ocr](https://huggingface.co/datasets/uv-scripts/ocr) | Extract text from images with VLMs (LaTeX, tables, forms) | βœ… |
| [classification](https://huggingface.co/datasets/uv-scripts/classification) | Text classification with guaranteed valid outputs | βœ… |
| [dataset-creation](https://huggingface.co/datasets/uv-scripts/dataset-creation) | Create datasets from PDFs and files | ❌ |
| [vllm](https://huggingface.co/datasets/uv-scripts/vllm) | High-performance inference with vLLM | βœ… |

## 🎯 Why UV Scripts?

### Zero Setup
No virtual environments, no dependency conflicts, no installation steps. UV handles everything automatically when you run the script.

### Production Ready
These aren't demos - they're production-quality tools used by the community for real ML workflows.

### GPU Optimized
Seamlessly run on local GPUs or scale to cloud with HF Jobs. Same script, different compute.

### Community Driven
Browse scripts, contribute your own, and learn from the best practices of the ML community.

## 🌟 Featured Scripts

### OCR Any Document Dataset
Extract text from images with state-of-the-art accuracy:
```bash
# Handles LaTeX, tables, forms, handwriting
uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \
  your-images extracted-text
```

### Classify with Guaranteed Valid Outputs  
Text classification that always returns valid labels:
```bash
# Uses vLLM's structured generation - no invalid outputs!
uv run https://huggingface.co/datasets/uv-scripts/classification/raw/main/classify-dataset.py \
  --input-dataset imdb --column text \
  --labels "positive,negative" --output-dataset imdb-classified
```

## πŸš€ Getting Started

1. **Install UV** (one-time setup):
   ```bash
   curl -LsSf https://astral.sh/uv/install.sh | sh
   ```

2. **Run any script**:
   ```bash
   uv run https://huggingface.co/datasets/uv-scripts/[collection]/raw/main/[script].py
   ```

3. **Or use HF Jobs** (no local GPU needed):
   ```bash
   hf jobs uv run --flavor l4x1 [script-url] [args]
   ```

## 🀝 Contributing

We welcome scripts that:
- Solve real ML problems
- Include clear documentation
- Follow UV best practices
- Work on both local and cloud

Submit your scripts as PRs to the relevant collection or propose a new collection!

## πŸ“– Learn More

- [UV Documentation](https://docs.astral.sh/uv/)
- [HF Jobs Guide](https://huggingface.co/docs/hub/spaces-gpu-jobs)
- [Script Examples](https://github.com/astral-sh/uv/tree/main/scripts)

---

*UV Scripts is a community project showcasing the power of [UV](https://github.com/astral-sh/uv) for ML workflows.*