forked from yash-dani/AutoAccounting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (34 loc) · 1.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gpt3 # user generated packages
from sheets import balanceSheet
from utils import clear
import webbrowser
if __name__ == '__main__':
clear()
# Intro text
print("------------------------------------------------------")
print('Welcome to the Balance Sheet Maker, powered by GPT-3.')
print("")
print('Your transaction -> python code -> Google Sheets file')
print("-----------------------------------------------------")
print()
statement = balanceSheet()
# Open sheet in browser
webbrowser.open('https://docs.google.com/spreadsheets/d/' +
statement.current_sheet_id, new=1)
# Loop to make requests to bot
while True:
print()
request = input("Tell me about your transaction:\n")
transactionInfo = gpt3.getGPT3(request) # get GPT-3 Output
# print(transactionInfo)
if type(transactionInfo) == list:
# Successfully parsed output
print()
print("Results:")
for transaction in transactionInfo:
print(transaction[0],transaction[1], "to ", transaction[2])
statement.update(transaction[0], transaction[1],transaction[2])
else:
# Error in parsing gpt3
print('GPT-3 was not able to process your statement. Try rewording it!')
clear()