Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ from dotenv import load_dotenv
|
|
5 |
import openai
|
6 |
from utils import generate_double_entry, save_transaction
|
7 |
|
|
|
8 |
load_dotenv()
|
9 |
-
|
10 |
openai.api_key = os.getenv(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)
|
11 |
openai.api_base = "https://api.groq.com/openai/v1"
|
12 |
|
@@ -21,9 +21,9 @@ def accounting_chatbot(user_input):
|
|
21 |
llm_output = call_groq(user_input)
|
22 |
debit, credit, amount = generate_double_entry(llm_output)
|
23 |
save_transaction(debit, credit, amount, user_input)
|
24 |
-
|
25 |
-
output = f"**Double Entry
|
26 |
return output
|
27 |
|
28 |
demo = gr.ChatInterface(fn=accounting_chatbot, title="AI Accounting Assistant")
|
29 |
-
demo.launch()
|
|
|
5 |
import openai
|
6 |
from utils import generate_double_entry, save_transaction
|
7 |
|
8 |
+
# Load key from Hugging Face secret or .env
|
9 |
load_dotenv()
|
|
|
10 |
openai.api_key = os.getenv(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)
|
11 |
openai.api_base = "https://api.groq.com/openai/v1"
|
12 |
|
|
|
21 |
llm_output = call_groq(user_input)
|
22 |
debit, credit, amount = generate_double_entry(llm_output)
|
23 |
save_transaction(debit, credit, amount, user_input)
|
24 |
+
|
25 |
+
output = f"**Double Entry**\\n- Debit: {debit}\\n- Credit: {credit}\\n- Amount: {amount}\\n\\n🧠 {llm_output}"
|
26 |
return output
|
27 |
|
28 |
demo = gr.ChatInterface(fn=accounting_chatbot, title="AI Accounting Assistant")
|
29 |
+
demo.launch()
|