Spaces:
Runtime error
Runtime error
Commit
Β·
d98b634
1
Parent(s):
636fd12
update readme with instructions
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: π₯
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
@@ -13,5 +13,47 @@ hf_oauth: true
|
|
13 |
# optional, default duration is 8 hours/480 minutes. Max duration is 30 days/43200 minutes.
|
14 |
hf_oauth_expiration_minutes: 480
|
15 |
---
|
|
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: TTS
|
3 |
emoji: π₯
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
|
|
13 |
# optional, default duration is 8 hours/480 minutes. Max duration is 30 days/43200 minutes.
|
14 |
hf_oauth_expiration_minutes: 480
|
15 |
---
|
16 |
+
# Getting Started
|
17 |
+
> This spaces allows you to create speech audio from text. It currently works with OpenAI and Cartesia AI.
|
18 |
|
19 |
+
## Running Locally
|
20 |
+
```bash
|
21 |
+
git clone https://huggingface.co/spaces/matdmiller/tts-openai
|
22 |
+
cd tts-openai
|
23 |
+
pip install -r requirements.txt
|
24 |
+
```
|
25 |
+
Next create a file `tts_openai_secrets.py` to hold the secrets or set them up as environment variables yourself.
|
26 |
+
```python
|
27 |
+
import os
|
28 |
+
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
|
29 |
+
os.environ["CARTESIA_API_KEY"]= 'xxx'
|
30 |
+
os.environ["ALLOWED_OAUTH_PROFILE_USERNAMES"]= '<your huggingface username>' #comma delimited
|
31 |
+
os.environ["REQUIRE_AUTH"]= 'false'
|
32 |
+
```
|
33 |
+
This file is included in the `.gitignore` so it will not be included when you publish to your repo. This is very important because the π€ Spaces repos are public by default and you don't want to leak your API keys.
|
34 |
+
|
35 |
+
Finally to run locally simply run:
|
36 |
+
```bash
|
37 |
+
python app.py
|
38 |
+
```
|
39 |
+
|
40 |
+
## Cloning to run in your own π€ Space.
|
41 |
+
|
42 |
+
Click the `...` in the top right hand corder of my Space and click `Duplicate Space`.
|
43 |
+
|
44 |
+

|
45 |
+
|
46 |
+
This will bring up a form that you need to fill out with the appropriate keys and settings.
|
47 |
+
|
48 |
+

|
49 |
+
|
50 |
+
- Owner: Your HF Username
|
51 |
+
- Visibility: Public (Or Private if you know what you're doing). By default this app is secured with π€ OAuth and only allows usernames you specify in the `ALLOWED_OAUTH_PROFILE_USERNAMES` property.
|
52 |
+
- Space Hardware: Free CPU Basic is plenty of horsepower for this app becuase all of the TTS work is happening behind the API.
|
53 |
+
- `OPENAI_API_KEY`: Input your own OpenAI API key which you can get by signing up for an account on [https://platform.openai.com](https://platform.openai.com). This is completely separate from ChatGPT.
|
54 |
+
- `CARTESIA_API_KEY`: Input your own Cartesia AI API key which you can obtain from [https://play.cartesia.ai/subscription](https://play.cartesia.ai/subscription)
|
55 |
+
- `ALLOWED_OAUTH_PROFILE_USERNAMES`: Add a comma separated list of Hugging Face usernames that are allowed to use the space. Only usernames listed here will be allowed generate speech audio, though anyone can view the site. Ex: `santa1225,clem2024`. If you have a single username, don't add a comma.
|
56 |
+
|
57 |
+
Click `Duplicate Space`. Your new space should be created within a couple of minutes.
|
58 |
+
|
59 |
+
Additional HF Spaced Config Info: https://huggingface.co/docs/hub/spaces-config-reference
|
app.ipynb
CHANGED
@@ -979,7 +979,7 @@
|
|
979 |
},
|
980 |
{
|
981 |
"cell_type": "code",
|
982 |
-
"execution_count":
|
983 |
"id": "0420310d-930b-4904-8bd4-3458ad8bdbd3",
|
984 |
"metadata": {},
|
985 |
"outputs": [],
|
|
|
979 |
},
|
980 |
{
|
981 |
"cell_type": "code",
|
982 |
+
"execution_count": 35,
|
983 |
"id": "0420310d-930b-4904-8bd4-3458ad8bdbd3",
|
984 |
"metadata": {},
|
985 |
"outputs": [],
|