Spaces:
Sleeping
Sleeping
| # Add your utilities or helper functions to this file. | |
| import os | |
| import json | |
| from dotenv import load_dotenv, find_dotenv | |
| from together import Together | |
| def load_env(): | |
| _ = load_dotenv(find_dotenv()) | |
| def load_world(filename): | |
| with open(filename, 'r') as f: | |
| return json.load(f) | |
| def save_world(world, filename): | |
| with open(filename, 'w') as f: | |
| json.dump(world, f) | |
| def get_together_api_key(): | |
| load_env() | |
| return os.getenv("TOGETHER_API_KEY") | |
| def load_world(filename): | |
| with open(filename, 'r') as f: | |
| return json.load(f) |