File size: 2,441 Bytes
5279f62 791e506 5279f62 791e506 |
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 |
---
license: cc-by-sa-4.0
base_model:
- vikp/texify
pipeline_tag: image-to-text
---
## texify-fp16-onnx
https://huggingface.co/vikp/texify with fp16 ONNX weights, shoutout to https://huggingface.co/Xenova/texify
## Usage (`optimum[onnxruntime]`)
If you haven't already, you can install the optimum with the onnxrumtime backend
```bash
pip install "optimum[onnxruntime-gpu]"
```
**Example:**
```python
from optimum.onnxruntime import ORTModelForVision2Seq
from optimum.pipelines import pipeline
model = ORTModelForVision2Seq.from_pretrained("Spedon/texify-fp16-onnx", provider="CUDAExecutionProvider")
texify = pipeline(
"image-to-text",
model,
feature_extractor="Spedon/texify-fp16-onnx",
image_processor="Spedon/texify-fp16-onnx",
)
image = (
"https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/latex.png"
)
latex = texify(image, max_new_tokens=384)
print(latex)
# [{'generated_text': "The potential $V_i$ of cell $\\mathcal{C}_i$ centred at position $\\mathbf{r}_i$ is related to the surface charge densities $\\sigma_j$ of cells $\\mathcal{C}_j$ $j\\in[1,N]$ through the superposition principle as: $$V_i\\,=\\,\\sum_{j=0}^{N}\\,\\frac{\\sigma_j}{4\\pi\\varepsilon_0}\\,\\int_{\\mathcal{C}_j}\\frac{1}{\\|\\mathbf{r}_i-\\mathbf{r}'\\|}\\,\\mathrm{d}^2\\mathbf{r}'\\,=\\,\\sum_{j=0}^{N}\\,Q_{ij}\\,\\sigma_j,$$ where the integral over the surface of cell $\\mathcal{C}_j$ only depends on $\\mathcal{C}_j$ shape and on the relative position of the target point $\\mathbf{r}_i$ with respect to $\\mathcal{C}_j$ location, as $\\sigma_j$ is assumed constant over the whole surface of cell $\\mathcal{C}_j$. "}]
```
| Input image | Visualized output |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/9UNWPwjFM-dRVf6m1gYJV.png) | ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/BK4wkPTqqvlTYeTPeEXTh.png) |
|