File size: 1,967 Bytes
3ec6543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# API Documentation for `Lenylvt/Text_to_SRT-API`

This documentation covers how to interact with the Text_to_SRT API using both Python and JavaScript.

## API Endpoint

To use this API, you can choose between the `gradio_client` Python library [docs](https://www.gradio.app/guides/getting-started-with-the-python-client) or the `@gradio/client` JavaScript package [doc](https://www.gradio.app/guides/getting-started-with-the-js-client).

## Python Usage

### Step 1: Installation

First, install the `gradio_client` if it's not already installed.

```python
pip install gradio_client
```

### Step 2: Making a Request

Find the API endpoint for the function you want to use. Replace the placeholder values in the snippet below with your input data. For private Spaces, you might need to include your Hugging Face token as well.

**API Name**: `/text_to_srt`

```python
from gradio_client import Client

client = Client("Lenylvt/Text_to_SRT-API")
result = client.predict(
    "Hello!!",  # str in 'Enter text' Textbox component
    api_name="/text_to_srt"
)
print(result)
```

**Return Type(s):**

- A `filepath` representing the output in the '*Download SRT File*' File component.

## JavaScript Usage

### Step 1: Installation

For JavaScript, install the `@gradio/client` package if it's not already present in your project.

```bash
npm i -D @gradio/client
```

### Step 2: Making a Request

Similar to Python, find the API endpoint that matches your desired function. Replace the placeholders with your own data. Include your Hugging Face token for private Spaces.

**API Name**: `/text_to_srt`

```javascript
import { client } from "@gradio/client";

const app = await client("Lenylvt/Text_to_SRT-API");
const result = await app.predict("/text_to_srt", [        
    "Hello!!", // string in 'Enter text' Textbox component
]);

console.log(result.data);
```

**Return Type(s):**

- `undefined` representing the output in the '*Download SRT File*' File component.