Spaces:
Runtime error
Runtime error
Update README.md
Browse files
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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
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 |
-
|
38 |
|
39 |
-
|
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 |
-
|
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 |
|