albhu commited on
Commit
c7fc47a
·
verified ·
1 Parent(s): 96120d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import streamlit as st
2
  import pandas as pd
 
3
  from datetime import datetime
4
  import requests
5
- from transformers import AutoTokenizer, AutoModelForTableQuestionAnswering
6
 
7
  class InterestCalculatorApp:
8
  def __init__(self):
@@ -115,15 +115,29 @@ def main():
115
 
116
  app = InterestCalculatorApp()
117
 
 
 
118
  file_path = st.file_uploader("Upload Invoices File", type=["xlsx"])
119
 
120
  if file_path is not None:
121
  app.load_invoices(file_path)
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  if st.button("Calculate Interest"):
124
  app.calculate_interest()
125
 
126
- app.download_boe_rates()
127
-
128
  if __name__ == "__main__":
129
  main()
 
1
  import streamlit as st
2
  import pandas as pd
3
+ from transformers import AutoTokenizer, AutoModelForTableQuestionAnswering
4
  from datetime import datetime
5
  import requests
 
6
 
7
  class InterestCalculatorApp:
8
  def __init__(self):
 
115
 
116
  app = InterestCalculatorApp()
117
 
118
+ app.download_boe_rates() # Download base rates first
119
+
120
  file_path = st.file_uploader("Upload Invoices File", type=["xlsx"])
121
 
122
  if file_path is not None:
123
  app.load_invoices(file_path)
124
 
125
+ query = st.text_input("Enter your query:")
126
+ if query:
127
+ # Assuming you have a DataFrame named 'invoices_df' containing the invoice data
128
+ if not app.invoices_df.empty:
129
+ # Display the invoice data
130
+ st.write("Invoice Data:")
131
+ st.write(app.invoices_df)
132
+
133
+ # Call TAPAS model to answer user's query
134
+ answer = app.ask_tapas(query, app.invoices_df)
135
+ st.write("Answer:", answer)
136
+ else:
137
+ st.warning("Please upload the invoices file first.")
138
+
139
  if st.button("Calculate Interest"):
140
  app.calculate_interest()
141
 
 
 
142
  if __name__ == "__main__":
143
  main()