MasteredUltraInstinct commited on
Commit
ad40dc4
Β·
verified Β·
1 Parent(s): a0c4a31

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -10
README.md CHANGED
@@ -1,13 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: PolSOL
3
- emoji: 🏒
4
- colorFrom: green
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 5.33.2
8
- app_file: app.py
9
- pinned: false
10
- license: mit
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
1
+ # πŸ“ Handwritten Polynomial Solver
2
+
3
+ This Hugging Face Space fine-tunes a Pix2Tex-style architecture using TrOCR on the [Azu/Handwritten-Mathematical-Expression-Convert-LaTeX](https://huggingface.co/datasets/Azu/Handwritten-Mathematical-Expression-Convert-LaTeX) dataset (~12K labeled handwritten math expressions). It then uses the trained model to extract LaTeX from user-uploaded images and solve polynomial equations step-by-step.
4
+
5
+ ---
6
+
7
+ ## πŸš€ How to Use
8
+
9
+ ### πŸ”§ Phase 1: Train the OCR Model
10
+
11
+ 1. Rename:
12
+ - `app.py` β†’ `app_ui.py`
13
+ - `train.py` β†’ `app.py`
14
+
15
+ 2. Rebuild the Space (top-right corner ➜ "Runtime ➜ Restart & Run All").
16
+
17
+ 3. Wait for training to finish (~10–20 min). A `trained_model/` directory will be saved.
18
+
19
+ ---
20
+
21
+ ### 🎨 Phase 2: Run the UI
22
+
23
+ 1. Rename:
24
+ - `app_ui.py` β†’ `app.py`
25
+ - `app.py` (the old training script) β†’ `train.py` (optional)
26
+
27
+ 2. Rebuild again.
28
+
29
+ 3. Upload a handwritten math image (like `x^3 + 3x - 2 = 0`), and it will:
30
+ - Extract LaTeX
31
+ - Clean & standardize
32
+ - Parse and simplify
33
+ - Solve and show roots step-by-step
34
+
35
+ ---
36
+
37
+ ## πŸ’» Notes
38
+
39
+ - **CPU-only**: Designed to work in free CPU-only Spaces.
40
+ - **Training config**:
41
+ - Samples: 1,000 (you can increase later)
42
+ - Batch size: 2
43
+ - Epochs: 1
44
+ - Based on `microsoft/trocr-base-handwritten` for OCR.
45
+
46
  ---
47
+
48
+ ## πŸ“¦ Files
49
+
50
+ | File | Purpose |
51
+ |--------------|--------------------------------------|
52
+ | `app.py` | Gradio UI (after training is done) |
53
+ | `train.py` | Trains the model |
54
+ | `model.py` | OCR wrapper for inference |
55
+ | `requirements.txt` | Python dependencies |
56
+
57
  ---
58
 
59
+ ## βœ… Status
60
+
61
+ - [x] Handwritten OCR
62
+ - [x] Step-by-step solving
63
+ - [x] Fine-tuning on real handwritten dataset
64
+