add readme
This commit is contained in:
parent
0a9571de3d
commit
b4e332b525
@ -0,0 +1,9 @@
|
|||||||
|
for cloning: `git config --global http.sslverify false`
|
||||||
|
for installing the environment, install uv -> `pip install uv`
|
||||||
|
after that, create an environment `uv venv`
|
||||||
|
install the packages by running `uv sync`
|
||||||
|
|
||||||
|
create an .env file by running `touch .env`
|
||||||
|
add the following line: `TOGETHER_API_KEY=<together API key>`
|
||||||
|
if you don't have it, please ask me :)
|
||||||
|
|
||||||
10
helper.py
10
helper.py
@ -1,20 +1,24 @@
|
|||||||
# Add your utilities or helper functions to this file.
|
# Add your utilities or helper functions to this file.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
from dotenv import load_dotenv, find_dotenv
|
from dotenv import load_dotenv, find_dotenv
|
||||||
|
|
||||||
# these expect to find a .env file at the directory above the lesson. # the format for that file is (without the comment) # API_KEYNAME=AStringThatIsTheLongAPIKeyFromSomeService
|
|
||||||
def load_env():
|
def load_env():
|
||||||
_ = load_dotenv(find_dotenv())
|
_ = load_dotenv(find_dotenv())
|
||||||
|
|
||||||
|
|
||||||
def save_world(world, filename):
|
def save_world(world, filename):
|
||||||
with open(filename, 'w') as f:
|
with open(filename, "w") as f:
|
||||||
json.dump(world, f)
|
json.dump(world, f)
|
||||||
|
|
||||||
|
|
||||||
def load_world(filename):
|
def load_world(filename):
|
||||||
with open(filename, 'r') as f:
|
with open(filename, "r") as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
|
|
||||||
def get_together_api_key():
|
def get_together_api_key():
|
||||||
load_env()
|
load_env()
|
||||||
together_api_key = os.getenv("TOGETHER_API_KEY")
|
together_api_key = os.getenv("TOGETHER_API_KEY")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user