Documentation / docs /SRT /TextTo.md
Lenylvt's picture
Rename docs/Text to SRT/API.md to docs/SRT/TextTo.md
08c9741 verified
|
raw
history blame
No virus
1.97 kB
# 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.