Spaces:
Sleeping
Sleeping
anmolsahai
commited on
Commit
•
dbfae32
1
Parent(s):
8422d6c
revert
Browse files- __pycache__/langchain_pipeline.cpython-310.pyc +0 -0
- app.py +36 -9
- langchain_pipeline.py +0 -0
__pycache__/langchain_pipeline.cpython-310.pyc
CHANGED
Binary files a/__pycache__/langchain_pipeline.cpython-310.pyc and b/__pycache__/langchain_pipeline.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -35,9 +35,10 @@ min_transaction_overdraft = st.number_input(
|
|
35 |
|
36 |
uploaded_file = st.file_uploader("Choose a file")
|
37 |
if uploaded_file is not None:
|
|
|
38 |
with st.spinner('Please wait ...'):
|
39 |
try:
|
40 |
-
|
41 |
uploaded_file,
|
42 |
model_name,
|
43 |
balance_type,
|
@@ -46,13 +47,39 @@ if uploaded_file is not None:
|
|
46 |
min_overdrawn_fee,
|
47 |
min_transaction_overdraft
|
48 |
)
|
49 |
-
st.success(f"Redlined document saved to {output_path}")
|
50 |
-
with open(output_path, "rb") as file:
|
51 |
-
st.download_button(
|
52 |
-
label="Download Redlined Document",
|
53 |
-
data=file,
|
54 |
-
file_name="Redlined_Reg_E_Notice.docx",
|
55 |
-
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
56 |
-
)
|
57 |
except Exception as e:
|
58 |
st.exception(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
uploaded_file = st.file_uploader("Choose a file")
|
37 |
if uploaded_file is not None:
|
38 |
+
diff = ""
|
39 |
with st.spinner('Please wait ...'):
|
40 |
try:
|
41 |
+
diff = pipeline(
|
42 |
uploaded_file,
|
43 |
model_name,
|
44 |
balance_type,
|
|
|
47 |
min_overdrawn_fee,
|
48 |
min_transaction_overdraft
|
49 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
except Exception as e:
|
51 |
st.exception(e)
|
52 |
+
|
53 |
+
diff_lines = diff.split("\n")
|
54 |
+
|
55 |
+
styled_diff = """
|
56 |
+
<style>
|
57 |
+
body {
|
58 |
+
font-family: 'Times New Roman', serif;
|
59 |
+
line-height: 1.5;
|
60 |
+
}
|
61 |
+
.diff {
|
62 |
+
margin: 10px 0;
|
63 |
+
padding: 5px;
|
64 |
+
}
|
65 |
+
.add {
|
66 |
+
color: green;
|
67 |
+
}
|
68 |
+
.remove {
|
69 |
+
color: red;
|
70 |
+
}
|
71 |
+
</style>
|
72 |
+
<div>
|
73 |
+
"""
|
74 |
+
for line in diff_lines:
|
75 |
+
if line.startswith('+'):
|
76 |
+
styled_diff += f'<div class="diff add">{line}</div>'
|
77 |
+
elif line.startswith('-'):
|
78 |
+
styled_diff += f'<div class="diff remove">{line}</div>'
|
79 |
+
else:
|
80 |
+
styled_diff += f'<div class="diff">{line}</div>'
|
81 |
+
styled_diff += "</div>"
|
82 |
+
|
83 |
+
st.markdown(styled_diff, unsafe_allow_html=True)
|
84 |
+
|
85 |
+
st.markdown("The key changes are:")
|
langchain_pipeline.py
CHANGED
The diff for this file is too large to render.
See raw diff
|
|