Giter VIP home page Giter VIP logo

api-examples's People

Contributors

mathpixsrc avatar nicodjimenez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-examples's Issues

MathPix-API: PHP sample is missing

Could you add an example for PHP, I am stuck with this custom code:

$uploadedFile = file_get_contents('ztest.jpg');

$ch = curl_init();

curl_setopt_array($ch, array(
	CURLOPT_RETURNTRANSFER => true, // receive server response
	CURLOPT_URL => "https://api.mathpix.com/v3/latex",
	CURLOPT_POST => 1,
	CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
	CURLOPT_POSTFIELDS => array(
		"app_id" => "trial",
		"app_key" => "34f1a4cea0eaca8540c95908b4dc84ab",
		"src" => "data:image/jpeg;base64,".base64_encode($uploadedFile), // data	
	)
));

$result = curl_exec($ch);

curl_close($ch);

// further processing
if($result == "OK") 
{
	// **** how to access the latex results?!
	var_dump('Okay');
} 
else 
{
	var_dump($result);
}

I guess the data should not be sent by "src" but differently using CURL.

Still uses old endpoint

It uses https://api.mathpix.com/v3/latex as endpoint which is outdated. It should be https://api.mathpix.com/v3/text.

Why I get an error ...

{
"error": "Invalid credentials",
"error_info": {
"id": "http_unauthorized",
"message": "Invalid credentials"
}
}

error while 'python python/test.py images/algebra.jpg'

{
"error": "Invalid credentials",
"error_info": {
"id": "http_unauthorized",
"message": "Invalid credentials"
}
}

what does this means?
I use python3.6, so my code is

#!/usr/bin/env python
import sys
import base64
import requests
import json

file_path = sys.argv[1]
image_uri = "data:image/jpg;base64," + base64.b64encode(open(file_path, "rb").read()).decode()
r = requests.post("https://api.mathpix.com/v3/latex",
    data=json.dumps({'src': image_uri,
        'formats': ['latex_normal', 'latex_styled']}),
    headers={"app_id": "trial", "app_key": "34f1a4cea0eaca8540c95908b4dc84ab",
        "Content-type": "application/json"})
print(json.dumps(json.loads(r.text), indent=4, sort_keys=True))

[Bug]: Recognition of vertical Japanese documents is problematic

Description
Hello,

I have encountered an issue while using Mathpix to recognize text in a Japanese PDF book where the text is vertically aligned. The recognition quality is poor, and many characters are not recognized correctly. Here are the details:

Text Alignment: Japanese text is arranged vertically from top to bottom and right to left.
File Type: PDF
Issue Observed: The recognition results show missing characters, incorrect characters, and some characters that are not recognized at all.

Attachments
https://drive.google.com/file/d/1Z1LcEuuuqGOyTgyjckdvzN_DSd0JFsmo/view?usp=sharing

Immersive Translate Feedback Zone

Dear Mathpix Support Team,

I hope this message is helpful to you. I am a member of the Immersive Translate team, and we have been utilizing Mathpix for our translation projects with great enthusiasm. We deeply appreciate the innovative solutions your product offers, which have significantly enhanced our workflow. At the same time, we also encountered some problems when using Mathpix, I will explain them separately in this issue, hoping to get your help, thanks!

API usage

How can i use API in python for any other image
please mention the required steps

bug: -215:Assertion failed)

latex {'request_id': 'c590d176a336a9eaa488383fcd8f78c4', 'error': "OpenCV(4.2.0) /io/opencv/modules/imgproc/src/resize.cpp:4048: error: (-215:Assertion failed) inv_scale_x > 0 in function 'resize'\n", 'error_info': {'id': 'sys_exception', 'message': "OpenCV(4.2.0) /io/opencv/modules/imgproc/src/resize.cpp:4048: error: (-215:Assertion failed) inv_scale_x > 0 in function 'resize'\n"}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.