build: Create start script to make things easier to start
This commit is contained in:
parent
a42612ad34
commit
045a321a4f
4 changed files with 13 additions and 11 deletions
|
|
@ -22,7 +22,7 @@ Currently in development. Goal is to eventually have ChatGPT nicely translate al
|
|||
2. Add your API key and Organization Key to a .env file. An example can be found in the repo.
|
||||
3. Add a prompt.txt file using prompt.example as a template. (See ChatGPT Prompt Section)
|
||||
4. Untranslated JSON files go in `/files`. Anything translated will end up in `/translated`
|
||||
5. Run `main.py` script either with VSCode or by running `.\main.py` in a CLI.
|
||||
5. Run `start.py` script either with VSCode or by running `python .\start.py` in a CLI.
|
||||
|
||||
## ChatGPT Prompt:
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ from tqdm import tqdm
|
|||
load_dotenv()
|
||||
openai.organization = os.getenv('org')
|
||||
openai.api_key = os.getenv('key')
|
||||
APICOST = .002 # Depends on the model https://openai.com/pricing
|
||||
|
||||
APICOST = .002 # Depends on the model https://openai.com/pricing
|
||||
PROMPT = Path('prompt.txt').read_text(encoding='utf-8')
|
||||
THREADS = 20
|
||||
LOCK = threading.Lock()
|
||||
|
|
|
|||
17
src/main.py
17
src/main.py
|
|
@ -4,17 +4,17 @@ import traceback
|
|||
from colorama import Fore
|
||||
import os
|
||||
|
||||
from rpgmakermvmz import handleMVMZ
|
||||
from rpgmakerace import handleACE
|
||||
from csvtl import handleCSV
|
||||
from src.rpgmakermvmz import handleMVMZ
|
||||
from src.rpgmakerace import handleACE
|
||||
from src.csvtl import handleCSV
|
||||
|
||||
THREADS = 20
|
||||
|
||||
# Info Message
|
||||
print(Fore.LIGHTYELLOW_EX + "Do not close while translation is in progress. If a file fails or gets stuck, \
|
||||
Translated lines will remain translated so you don't have to worry about being charged \
|
||||
twice. You can simply copy the file generated in /translations back over to /files and \
|
||||
start the script again. It will skip over any translated text." + Fore.RESET, end='\n\n')
|
||||
print(Fore.LIGHTYELLOW_EX + "WARNING: Once a translation starts do not close it unless you want to lose your\
|
||||
translated data. If a file fails or gets stuck, translated lines will remain translated so you don't have \
|
||||
to worry about being charged twice. You can simply copy the file generated in /translations back over to \
|
||||
/files and start the script again. It will skip over any translated text." + Fore.RESET, end='\n\n')
|
||||
|
||||
def main():
|
||||
estimate = ''
|
||||
|
|
@ -65,6 +65,7 @@ def main():
|
|||
for future in as_completed(futures):
|
||||
try:
|
||||
totalCost = future.result()
|
||||
|
||||
except Exception as e:
|
||||
tracebackLineNo = str(traceback.extract_tb(sys.exc_info()[2])[-1].lineno)
|
||||
print(Fore.RED + str(e) + '|' + tracebackLineNo + Fore.RESET)
|
||||
|
|
@ -85,5 +86,3 @@ def deleteFolderFiles(folderPath):
|
|||
file_path = os.path.join(folderPath, filename)
|
||||
if file_path.endswith('.json'):
|
||||
os.remove(file_path)
|
||||
|
||||
main()
|
||||
|
|
|
|||
3
start.py
Normal file
3
start.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from src.main import main
|
||||
|
||||
main()
|
||||
Loading…
Reference in a new issue