Merge pull request #27 from tomchapin/feature/adding-dotenv

Feature/adding dotenv
pull/26/head^2
killian 11 months ago committed by GitHub
commit 8dc865aa87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

2
.gitignore vendored

@ -160,4 +160,4 @@ cython_debug/
# 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.
#.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"

1
OS/01/.gitignore vendored

@ -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 threading
import os

@ -1,3 +1,6 @@
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
import os
import glob
import json

@ -1,3 +1,6 @@
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
import os
import subprocess
from pathlib import Path

@ -2,6 +2,10 @@
Exposes a SSE streaming server endpoint at /run, which recieves language and code,
and streams the output.
"""
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
import os
import json
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
import ast
import json

@ -1,33 +1,10 @@
### SETTINGS
# 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"
### 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
### SETUP

@ -2,6 +2,9 @@
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
import os
import contextlib

@ -2,6 +2,9 @@
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
from openai import OpenAI
from pydub import AudioSegment

@ -1,3 +1,6 @@
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
import asyncio
import subprocess
import platform

@ -1,3 +1,6 @@
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
import os
import logging

@ -8,7 +8,11 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
<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
# MacOS

Loading…
Cancel
Save