Merge pull request #27 from tomchapin/feature/adding-dotenv
Feature/adding dotenv
This commit is contained in:
commit
8dc865aa87
|
@ -160,4 +160,4 @@ cython_debug/
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
OS/01/conversations/user.json
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
### SETTINGS
|
||||||
|
# Copy this file and rename it to ".env" to use it.
|
||||||
|
|
||||||
|
# If ALL_LOCAL is False, we'll use OpenAI's services
|
||||||
|
# If setting ALL_LOCAL to true, set the path to the WHISPER local model
|
||||||
|
ALL_LOCAL=False
|
||||||
|
# WHISPER_MODEL_PATH=...
|
||||||
|
# OPENAI_API_KEY=sk-...
|
||||||
|
|
||||||
|
# For TTS, we use the en_US-lessac-medium voice model by default
|
||||||
|
# Please change the voice URL and voice name if you wish to use another voice
|
||||||
|
export PIPER_VOICE_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/"
|
||||||
|
export PIPER_VOICE_NAME="en_US-lessac-medium.onnx"
|
||||||
|
|
||||||
|
# If SERVER_START, this is where we'll serve the server.
|
||||||
|
# If DEVICE_START, this is where the device expects the server to be.
|
||||||
|
SERVER_URL=ws://localhost:8000/
|
||||||
|
SERVER_START=True
|
||||||
|
DEVICE_START=True
|
||||||
|
|
||||||
|
# Control where various operations happen— can be `device` or `server`.
|
||||||
|
CODE_RUNNER=server
|
||||||
|
TTS_RUNNER=server # If device, audio will be sent over websocket.
|
||||||
|
STT_RUNNER=device # If server, audio will be sent over websocket.
|
||||||
|
|
||||||
|
# Will expose the server publically and display that URL.
|
||||||
|
SERVER_EXPOSE_PUBLICALLY=False
|
||||||
|
|
||||||
|
# Debug level
|
||||||
|
# LOG_LEVEL=DEBUG
|
||||||
|
LOG_LEVEL="INFO"
|
|
@ -0,0 +1 @@
|
||||||
|
conversations/user.json
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
Exposes a SSE streaming server endpoint at /run, which recieves language and code,
|
Exposes a SSE streaming server endpoint at /run, which recieves language and code,
|
||||||
and streams the output.
|
and streams the output.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from interpreter import interpreter
|
from interpreter import interpreter
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
from starlette.websockets import WebSocketDisconnect
|
from starlette.websockets import WebSocketDisconnect
|
||||||
import ast
|
import ast
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -1,33 +1,10 @@
|
||||||
### SETTINGS
|
### Import Environment Variables from .env
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
echo "Error: .env file does not exist. To create one, see .env.example for an example."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set -a; source .env; set +a
|
||||||
|
|
||||||
# If ALL_LOCAL is False, we'll use OpenAI's services
|
|
||||||
# If setting ALL_LOCAL to true, set the path to the WHISPER local model
|
|
||||||
export ALL_LOCAL=False
|
|
||||||
# export WHISPER_MODEL_PATH=...
|
|
||||||
# export OPENAI_API_KEY=sk-...
|
|
||||||
|
|
||||||
# For TTS, we use the en_US-lessac-medium voice model by default
|
|
||||||
# Please change the voice URL and voice name if you wish to use another voice
|
|
||||||
export PIPER_VOICE_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/"
|
|
||||||
export PIPER_VOICE_NAME="en_US-lessac-medium.onnx"
|
|
||||||
|
|
||||||
# If SERVER_START, this is where we'll serve the server.
|
|
||||||
# If DEVICE_START, this is where the device expects the server to be.
|
|
||||||
export SERVER_URL=ws://localhost:8000/
|
|
||||||
export SERVER_START=True
|
|
||||||
export DEVICE_START=True
|
|
||||||
|
|
||||||
# Control where various operations happen— can be `device` or `server`.
|
|
||||||
export CODE_RUNNER=server
|
|
||||||
export TTS_RUNNER=server # If device, audio will be sent over websocket.
|
|
||||||
export STT_RUNNER=device # If server, audio will be sent over websocket.
|
|
||||||
|
|
||||||
# Will expose the server publically and display that URL.
|
|
||||||
export SERVER_EXPOSE_PUBLICALLY=False
|
|
||||||
|
|
||||||
# Debug level
|
|
||||||
# export LOG_LEVEL=DEBUG
|
|
||||||
export LOG_LEVEL="INFO"
|
|
||||||
|
|
||||||
### SETUP
|
### SETUP
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
Defines a function which takes a path to an audio file and turns it into text.
|
Defines a function which takes a path to an audio file and turns it into text.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
Defines a function which takes text and returns a path to an audio file.
|
Defines a function which takes text and returns a path to an audio file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import subprocess
|
import subprocess
|
||||||
import platform
|
import platform
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # take environment variables from .env.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,11 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Setup
|
## Configuration:
|
||||||
|
|
||||||
|
Copy the OS/01/.env.example file to OS/01/.env and then configure the environment variables within the file.
|
||||||
|
|
||||||
|
## Install Required Libraries:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# MacOS
|
# MacOS
|
||||||
|
|
Loading…
Reference in New Issue