Abijith commited on
Commit
fcb1298
·
verified ·
1 Parent(s): 2f64d07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -134,24 +134,22 @@ if uploaded_files:
134
 
135
  # Suggested Comparative Questions
136
  comparative_questions = [
137
- "Compare revenue growth between both fiscal years",
138
  "Analyze changes in debt structure across both reports",
139
  "Show expense ratio differences between the two years",
140
  "What are the main liquidity changes across both periods?",
141
- "How does net profit margin compare between the two reports?"
142
  ]
143
- user_query = st.selectbox("Sample Comparative Questions",
144
  [""] + comparative_questions)
145
- user_input = st.text_input("Or enter custom comparative query:",
146
  value=user_query)
147
 
148
  if user_input:
149
  # Input Validation Guardrail
150
  classification = classifier(user_input,
151
- ["financial comparison", "other"],
152
  multi_label=False)
153
  if classification['scores'][0] < 0.2:
154
- st.error("Query not comparative/financial. Ask about financial comparisons between documents.")
155
  st.stop()
156
 
157
  with st.spinner("Performing Cross-Document Analysis..."):
@@ -194,7 +192,7 @@ if uploaded_files:
194
  st.caption(f"Analysis Confidence: {confidence_score}%")
195
 
196
  # Export Functionality
197
- if st.button("Generate Comparative Report"):
198
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
199
  export_content = f"COMPARATIVE QUERY: {user_input}\n\nANALYSIS:\n{clean_analysis}"
200
  st.download_button("Download Full Report", export_content,
 
134
 
135
  # Suggested Comparative Questions
136
  comparative_questions = [
 
137
  "Analyze changes in debt structure across both reports",
138
  "Show expense ratio differences between the two years",
139
  "What are the main liquidity changes across both periods?",
 
140
  ]
141
+ user_query = st.selectbox("Sample Financial Questions",
142
  [""] + comparative_questions)
143
+ user_input = st.text_input("Or enter custom financial query:",
144
  value=user_query)
145
 
146
  if user_input:
147
  # Input Validation Guardrail
148
  classification = classifier(user_input,
149
+ ["financial", "other"],
150
  multi_label=False)
151
  if classification['scores'][0] < 0.2:
152
+ st.error("Query not related to financial. Ask about financial related queries")
153
  st.stop()
154
 
155
  with st.spinner("Performing Cross-Document Analysis..."):
 
192
  st.caption(f"Analysis Confidence: {confidence_score}%")
193
 
194
  # Export Functionality
195
+ if st.button("Generate Financial Analysis Report"):
196
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
197
  export_content = f"COMPARATIVE QUERY: {user_input}\n\nANALYSIS:\n{clean_analysis}"
198
  st.download_button("Download Full Report", export_content,