Update README.md
Browse files
README.md
CHANGED
|
@@ -13,9 +13,15 @@ base_model: google/pix2struct-base
|
|
| 13 |
|
| 14 |
*Turn table images into HTML!*
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
## About
|
| 17 |
|
| 18 |
-
This model takes an image of a table and outputs HTML - the model parses
|
| 19 |
|
| 20 |
The model expects an image containing only a table. If the table is embedded in a document, first use a table detection model to extract it.
|
| 21 |
|
|
@@ -25,7 +31,7 @@ The model has been trained using two datasets: [MMTab](https://huggingface.co/da
|
|
| 25 |
|
| 26 |
## Usage
|
| 27 |
|
| 28 |
-
Below is a complete example
|
| 29 |
|
| 30 |
```python
|
| 31 |
import torch
|
|
@@ -42,7 +48,6 @@ model.to(device)
|
|
| 42 |
model.eval()
|
| 43 |
|
| 44 |
# Load example image from URL
|
| 45 |
-
# Example from the MMTab dataset
|
| 46 |
url = "https://example.com/path_to_table_image.jpg"
|
| 47 |
response = requests.get(url)
|
| 48 |
image = Image.open(BytesIO(response.content))
|
|
@@ -59,11 +64,3 @@ predictions_decoded = processor.tokenizer.batch_decode(predictions, skip_special
|
|
| 59 |
# Show predictions as text
|
| 60 |
print(predictions_decoded[0])
|
| 61 |
```
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
## Demo app
|
| 68 |
-
|
| 69 |
-
Try the [demo app]() which contain both table detection and recognition!
|
|
|
|
| 13 |
|
| 14 |
*Turn table images into HTML!*
|
| 15 |
|
| 16 |
+
|
| 17 |
+
## Demo app
|
| 18 |
+
|
| 19 |
+
Try the [demo app]() which contains both table detection and recognition!
|
| 20 |
+
|
| 21 |
+
|
| 22 |
## About
|
| 23 |
|
| 24 |
+
This model takes an image of a table and outputs HTML - the model parses the image and performs optical character recognition (OCR) and structure recognition to HTML format.
|
| 25 |
|
| 26 |
The model expects an image containing only a table. If the table is embedded in a document, first use a table detection model to extract it.
|
| 27 |
|
|
|
|
| 31 |
|
| 32 |
## Usage
|
| 33 |
|
| 34 |
+
Below is a complete example of loading the model and performing inference on an example table image (example from the [MMTab dataset](https://huggingface.co/datasets/SpursgoZmy/MMTab)):
|
| 35 |
|
| 36 |
```python
|
| 37 |
import torch
|
|
|
|
| 48 |
model.eval()
|
| 49 |
|
| 50 |
# Load example image from URL
|
|
|
|
| 51 |
url = "https://example.com/path_to_table_image.jpg"
|
| 52 |
response = requests.get(url)
|
| 53 |
image = Image.open(BytesIO(response.content))
|
|
|
|
| 64 |
# Show predictions as text
|
| 65 |
print(predictions_decoded[0])
|
| 66 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|