Skip to content

Normalize indentation for the vision includes #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions en/_includes/vision/base64-encode-command-pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,74 @@

- UNIX {#unix}

```
base64 -i input.pdf > output.txt
```
```
base64 -i input.pdf > output.txt
```

- Windows {#windows}

```
C:> Base64.exe -e input.pdf > output.txt
```
```
C:> Base64.exe -e input.pdf > output.txt
```

- PowerShell {#powershell}

```
[Convert]::ToBase64String([IO.File]::ReadAllBytes("./input.pdf")) > output.txt
```
```
[Convert]::ToBase64String([IO.File]::ReadAllBytes("./input.pdf")) > output.txt
```

- Python {#python}

```python
# Import a library for encoding files in Base64
import base64
```python
# Import a library for encoding files in Base64
import base64

# Create a function that will encode a file and return results.
def encode_file(file):
file_content = file.read()
return base64.b64encode(file_content)
```
# Create a function that will encode a file and return results.
def encode_file(file):
file_content = file.read()
return base64.b64encode(file_content)
```

- Node.js {#node}

```js
// Read the file contents to memory.
var fs = require('fs');
var file = fs.readFileSync('/path/to/file');
```js
// Read the file contents to memory.
var fs = require('fs');
var file = fs.readFileSync('/path/to/file');

// Get the file contents in Base64 format.
var encoded = Buffer.from(file).toString('base64');
```
// Get the file contents in Base64 format.
var encoded = Buffer.from(file).toString('base64');
```

- Java {#java}

```java
// Import a library for encoding files in Base64.
import org.apache.commons.codec.binary.Base64;
```java
// Import a library for encoding files in Base64.
import org.apache.commons.codec.binary.Base64;

// Get the file contents in Base64 format.
byte[] fileData = Base64.encodeBase64(yourFile.getBytes());
```
// Get the file contents in Base64 format.
byte[] fileData = Base64.encodeBase64(yourFile.getBytes());
```

- Go {#go}

```go
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)
```go
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 2 spaces fine for go?


// Open the file
f, _ := os.Open("/path/to/file")
// Open the file
f, _ := os.Open("/path/to/file")

// Read the file contents.
reader := bufio.NewReader(f)
content, _ := ioutil.ReadAll(reader)
// Read the file contents.
reader := bufio.NewReader(f)
content, _ := ioutil.ReadAll(reader)

// Get the file contents in Base64 format.
base64.StdEncoding.EncodeToString(content)
```
// Get the file contents in Base64 format.
base64.StdEncoding.EncodeToString(content)
```

{% endlist %}
10 changes: 5 additions & 5 deletions en/_includes/vision/base64-encode-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Create a function to encode a file and return the results.
def encode_file(file_path):
with open(file_path, "rb") as fid:
file_content = fid.read()
file_content = fid.read()
return base64.b64encode(file_content).decode("utf-8")
```

Expand Down Expand Up @@ -57,10 +57,10 @@

```go
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)

// Open the file.
Expand Down
2 changes: 1 addition & 1 deletion en/_includes/vision/send-request_ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Send a request using the [recognize](../../vision/ocr/api-ref/TextRecognition/re
"x-folder-id": "<folder_ID>",
"x-data-logging-enabled": "true"}

w = requests.post(url=url, headers=headers, data=json.dumps(data))
w = requests.post(url=url, headers=headers, data=json.dumps(data))
```

{% endlist %}
8 changes: 4 additions & 4 deletions ru/_includes/vision/base64-encode-command-pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@

```go
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)

// Откройте файл
Expand Down
10 changes: 5 additions & 5 deletions ru/_includes/vision/base64-encode-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Создайте функцию, которая кодирует файл и возвращает результат.
def encode_file(file_path):
with open(file_path, "rb") as fid:
file_content = fid.read()
file_content = fid.read()
return base64.b64encode(file_content).decode("utf-8")
```

Expand Down Expand Up @@ -57,10 +57,10 @@

```go
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)

// Откройте файл
Expand Down
2 changes: 1 addition & 1 deletion ru/_includes/vision/send-request_ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"x-folder-id": "<идентификатор_каталога>",
"x-data-logging-enabled": "true"}

w = requests.post(url=url, headers=headers, data=json.dumps(data))
w = requests.post(url=url, headers=headers, data=json.dumps(data))
```

{% endlist %}