Spaces:
Sleeping
Sleeping
eod
Browse files
app.py
CHANGED
@@ -299,14 +299,13 @@ def create_dataframe_from_text_2(text):
|
|
299 |
data_dict = json.loads(text)
|
300 |
|
301 |
# Extract the 'transactions' data
|
302 |
-
transactions_data = data_dict.get('
|
303 |
|
304 |
# Convert the 'transactions' list of dictionaries to a Pandas DataFrame
|
305 |
df = pd.DataFrame(transactions_data)
|
306 |
|
307 |
return df
|
308 |
|
309 |
-
|
310 |
template="You are a helpful assistant that annalyses a bank statement annd provides answers"
|
311 |
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
|
312 |
human_template= "{text}"
|
@@ -345,8 +344,7 @@ ONLY return the JSON.
|
|
345 |
prompt_2 = """Loan transaction details are the information of transaction happened during a period and contains
|
346 |
details like Month, EMI as monthly amount paid, Payment status as Paid or Unpaid, Interest Amount paid, outstanding Balance after payment of EMI.
|
347 |
|
348 |
-
|
349 |
-
Return a JSON object
|
350 |
|
351 |
1. COMBININNG monthly transactions for each month
|
352 |
2. WITHOUT missing rows for ANY month
|
@@ -364,7 +362,6 @@ prompt_template_2 = PromptTemplate.from_template(
|
|
364 |
)
|
365 |
#prompt_template_2.format(response_1 =response_1, loan_data=result.lower())
|
366 |
|
367 |
-
|
368 |
if st.button('Get Loan Details',type="primary"):
|
369 |
with st.spinner("π€ Operation in progress. Please wait! π€ "):
|
370 |
result = read_file_get_prompts(file_name)
|
@@ -372,7 +369,8 @@ if st.button('Get Loan Details',type="primary"):
|
|
372 |
#st.write(result.lower())
|
373 |
response_1 = OpenAI().complete(prompt_template_1.format(loan_data=result.lower()))
|
374 |
st.table(create_dataframe_from_text(response_1.text))
|
375 |
-
|
|
|
376 |
st.balloons()
|
377 |
|
378 |
async def get_completion(prompt_template, response="", data=""):
|
@@ -389,7 +387,7 @@ if st.button('Get Loan Transactions', type="primary"):
|
|
389 |
#st.write(result.lower())
|
390 |
#response_1 = get_completion(prompt_template_1, "", result)
|
391 |
|
392 |
-
response_2 = OpenAI().complete(prompt_template_2.format(response_1=
|
393 |
#st.write(response_2)
|
394 |
st.table(create_dataframe_from_text_2(response_2.text))
|
395 |
|
|
|
299 |
data_dict = json.loads(text)
|
300 |
|
301 |
# Extract the 'transactions' data
|
302 |
+
transactions_data = data_dict.get('transactions', [])
|
303 |
|
304 |
# Convert the 'transactions' list of dictionaries to a Pandas DataFrame
|
305 |
df = pd.DataFrame(transactions_data)
|
306 |
|
307 |
return df
|
308 |
|
|
|
309 |
template="You are a helpful assistant that annalyses a bank statement annd provides answers"
|
310 |
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
|
311 |
human_template= "{text}"
|
|
|
344 |
prompt_2 = """Loan transaction details are the information of transaction happened during a period and contains
|
345 |
details like Month, EMI as monthly amount paid, Payment status as Paid or Unpaid, Interest Amount paid, outstanding Balance after payment of EMI.
|
346 |
|
347 |
+
Return a JSON object called transactions by
|
|
|
348 |
|
349 |
1. COMBININNG monthly transactions for each month
|
350 |
2. WITHOUT missing rows for ANY month
|
|
|
362 |
)
|
363 |
#prompt_template_2.format(response_1 =response_1, loan_data=result.lower())
|
364 |
|
|
|
365 |
if st.button('Get Loan Details',type="primary"):
|
366 |
with st.spinner("π€ Operation in progress. Please wait! π€ "):
|
367 |
result = read_file_get_prompts(file_name)
|
|
|
369 |
#st.write(result.lower())
|
370 |
response_1 = OpenAI().complete(prompt_template_1.format(loan_data=result.lower()))
|
371 |
st.table(create_dataframe_from_text(response_1.text))
|
372 |
+
text_result = response_1.text
|
373 |
+
|
374 |
st.balloons()
|
375 |
|
376 |
async def get_completion(prompt_template, response="", data=""):
|
|
|
387 |
#st.write(result.lower())
|
388 |
#response_1 = get_completion(prompt_template_1, "", result)
|
389 |
|
390 |
+
response_2 = OpenAI().complete(prompt_template_2.format(response_1=text_result, loan_data=result.lower()))
|
391 |
#st.write(response_2)
|
392 |
st.table(create_dataframe_from_text_2(response_2.text))
|
393 |
|