add vendor statement - variable renames and copy tweaks
Browse files- app_chatgpt.py +13 -10
app_chatgpt.py
CHANGED
|
@@ -42,15 +42,18 @@ def extract_transactions(file):
|
|
| 42 |
raise ValueError(f"Error processing {file.name}: {e}")
|
| 43 |
|
| 44 |
|
| 45 |
-
def reconcile_statements_openai(erp_file,
|
| 46 |
yield "β³ Processing your request...", ""
|
| 47 |
|
| 48 |
try:
|
| 49 |
erp_data = extract_transactions(erp_file)
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
prompt = f"""
|
| 53 |
-
You are a financial analyst specializing in account reconciliations. Your task is to compare two data sets: one from an ERP system and the other from a
|
|
|
|
|
|
|
| 54 |
|
| 55 |
The goal is to identify which transactions match across both data sets, and which transactions are unmatched or potentially erroneous.
|
| 56 |
|
|
@@ -70,8 +73,8 @@ Please follow this format in your response:
|
|
| 70 |
|
| 71 |
3. π¦ **Unmatched Bank Transactions**
|
| 72 |
List any transactions found in
|
| 73 |
-
a.
|
| 74 |
-
b. ERP file but Not in
|
| 75 |
|
| 76 |
4. π§Ύ **Summary & Suggested Next Steps**
|
| 77 |
Explain what the discrepancies might mean and what the user should do next.
|
|
@@ -83,8 +86,8 @@ Here is the ERP data:
|
|
| 83 |
|
| 84 |
---
|
| 85 |
|
| 86 |
-
Here is the Bank data
|
| 87 |
-
{
|
| 88 |
"""
|
| 89 |
|
| 90 |
response = openai.ChatCompletion.create(
|
|
@@ -118,10 +121,10 @@ with gr.Blocks(css="""
|
|
| 118 |
}
|
| 119 |
""") as iface:
|
| 120 |
gr.Image("logo_Icon.png", elem_id="company-logo", label="Beiing Human")
|
| 121 |
-
gr.Markdown("## π ERP vs Bank Reconciliation Tool")
|
| 122 |
with gr.Row():
|
| 123 |
erp_file = gr.File(label="π Upload ERP Statement", type="filepath")
|
| 124 |
-
|
| 125 |
btn = gr.Button("π Reconcile")
|
| 126 |
with gr.Row():
|
| 127 |
support_btn = gr.Button(
|
|
@@ -138,7 +141,7 @@ with gr.Blocks(css="""
|
|
| 138 |
|
| 139 |
btn.click(
|
| 140 |
fn=reconcile_statements_openai,
|
| 141 |
-
inputs=[erp_file,
|
| 142 |
outputs=[status, result]
|
| 143 |
)
|
| 144 |
|
|
|
|
| 42 |
raise ValueError(f"Error processing {file.name}: {e}")
|
| 43 |
|
| 44 |
|
| 45 |
+
def reconcile_statements_openai(erp_file, external_file)::
|
| 46 |
yield "β³ Processing your request...", ""
|
| 47 |
|
| 48 |
try:
|
| 49 |
erp_data = extract_transactions(erp_file)
|
| 50 |
+
external_data = extract_transactions(external_file)
|
| 51 |
+
|
| 52 |
|
| 53 |
prompt = f"""
|
| 54 |
+
You are a financial analyst specializing in account reconciliations. Your task is to compare two data sets: one from an ERP system and the other from a
|
| 55 |
+
|
| 56 |
+
Bank or Vendor statement.
|
| 57 |
|
| 58 |
The goal is to identify which transactions match across both data sets, and which transactions are unmatched or potentially erroneous.
|
| 59 |
|
|
|
|
| 73 |
|
| 74 |
3. π¦ **Unmatched Bank Transactions**
|
| 75 |
List any transactions found in
|
| 76 |
+
a. External file but not in the ERP file OR
|
| 77 |
+
b. ERP file but Not in External file
|
| 78 |
|
| 79 |
4. π§Ύ **Summary & Suggested Next Steps**
|
| 80 |
Explain what the discrepancies might mean and what the user should do next.
|
|
|
|
| 86 |
|
| 87 |
---
|
| 88 |
|
| 89 |
+
Here is the External (Bank or Vendor) data::
|
| 90 |
+
{external_data}
|
| 91 |
"""
|
| 92 |
|
| 93 |
response = openai.ChatCompletion.create(
|
|
|
|
| 121 |
}
|
| 122 |
""") as iface:
|
| 123 |
gr.Image("logo_Icon.png", elem_id="company-logo", label="Beiing Human")
|
| 124 |
+
gr.Markdown("## π ERP vs Bank/Vendor Reconciliation Tool")
|
| 125 |
with gr.Row():
|
| 126 |
erp_file = gr.File(label="π Upload ERP Statement", type="filepath")
|
| 127 |
+
external_file = gr.File(label="π¦ Upload Bank or Vendor Statement", type="filepath")
|
| 128 |
btn = gr.Button("π Reconcile")
|
| 129 |
with gr.Row():
|
| 130 |
support_btn = gr.Button(
|
|
|
|
| 141 |
|
| 142 |
btn.click(
|
| 143 |
fn=reconcile_statements_openai,
|
| 144 |
+
inputs=[erp_file, external_file],
|
| 145 |
outputs=[status, result]
|
| 146 |
)
|
| 147 |
|