MasteredUltraInstinct commited on
Commit
dbd5ec5
Β·
verified Β·
1 Parent(s): 9e2a457

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -55
README.md CHANGED
@@ -1,64 +1,22 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: "Handwritten Polynomial Solver"
3
+ emoji: "🧠"
4
+ colorFrom: red
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: "3.0"
8
+ app_file: app.py
9
+ pinned: false
 
 
 
 
 
 
 
10
  ---
11
 
12
+ # Handwritten Polynomial Solver
13
 
14
+ This Space fine-tunes Pix2Tex on the Azu/Handwritten‑Mathematical‑Expression‑Convert‑LaTeX dataset (~12K handwritten math samples).
 
 
 
 
 
15
 
16
+ ## πŸš€ Usage
 
 
17
 
18
+ - **Train the model:** Rename `app.py β†’ app_ui.py` and `train.py β†’ app.py`, then rebuild the Space.
19
+ - **Switch to UI:** Once you see `trained_model/`, rename back (`app.py β†’ train.py`, `app_ui.py β†’ app.py`) and rebuild.
 
 
 
 
 
 
20
 
 
21
 
 
 
 
22