Noo88ear commited on
Commit
40b3a61
Β·
verified Β·
1 Parent(s): b1b85da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +119 -101
app.py CHANGED
@@ -723,136 +723,156 @@ def create_gradio_interface() -> gr.Blocks:
723
  **Deployed on Hugging Face Spaces with built-in Excel MCP Server support**
724
  """)
725
 
 
 
 
 
 
 
726
  with gr.Row():
727
- # =============================
728
- # LEFT COLUMN: Agent Instructions
729
- # =============================
730
  with gr.Column(scale=2):
731
- gr.Markdown("### πŸ’¬ Agent Instructions")
732
-
733
  custodian_prompt = gr.Textbox(
734
- label="πŸ›οΈ Custodian Instructions",
735
  placeholder="e.g., 'Look for AAPL positions affected by stock split'",
736
  lines=2
737
  )
738
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  cash_prompt = gr.Textbox(
740
- label="πŸ’° Cash Instructions",
741
  placeholder="e.g., 'Flag any trades over $1M requiring additional liquidity'",
742
  lines=2
743
  )
744
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745
  trade_prompt = gr.Textbox(
746
- label="πŸ“ˆ Trade Instructions",
747
  placeholder="e.g., 'Combine related trades from same counterparty'",
748
  lines=2
749
  )
750
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
751
  corporate_prompt = gr.Textbox(
752
- label="🏒 Corporate Instructions",
753
  placeholder="e.g., 'Check for dividend payments affecting settlement dates'",
754
  lines=2
755
  )
756
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
  web_prompt = gr.Textbox(
758
- label="🌐 Web Agent Instructions",
759
  placeholder="e.g., 'Search for AAPL stock split news, NVDA earnings updates, CTSH corporate actions'",
760
  lines=2
761
  )
762
-
763
- # =============================
764
- # CENTER COLUMN: Agent File Uploads & Status
765
- # =============================
766
- with gr.Column(scale=4):
767
- gr.Markdown("### πŸ“ Agent File Processing & Status")
768
-
769
- # Custodian Agent Row
770
- with gr.Row():
771
- gr.Markdown("#### πŸ›οΈ Custodian Agent")
772
- with gr.Row():
773
- with gr.Column(scale=2):
774
- custodian_upload = gr.File(
775
- label="Upload Files",
776
- file_count="multiple",
777
- file_types=[".xlsx", ".xls", ".csv"]
778
- )
779
- custodian_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
780
- with gr.Column(scale=2):
781
- custodian_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
782
- custodian_results = gr.Textbox(label="Results", lines=2, interactive=False)
783
-
784
- # Cash Agent Row
785
- with gr.Row():
786
- gr.Markdown("#### πŸ’° Cash Agent")
787
- with gr.Row():
788
- with gr.Column(scale=2):
789
- cash_upload = gr.File(
790
- label="Upload Files",
791
- file_count="multiple",
792
- file_types=[".xlsx", ".xls", ".csv"]
793
- )
794
- cash_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
795
- with gr.Column(scale=2):
796
- cash_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
797
- cash_results = gr.Textbox(label="Results", lines=2, interactive=False)
798
-
799
- # Trade Agent Row
800
- with gr.Row():
801
- gr.Markdown("#### πŸ“ˆ Trade Agent")
802
- with gr.Row():
803
- with gr.Column(scale=2):
804
- trade_upload = gr.File(
805
- label="Upload Files",
806
- file_count="multiple",
807
- file_types=[".xlsx", ".xls", ".csv"]
808
- )
809
- trade_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
810
- with gr.Column(scale=2):
811
- trade_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
812
- trade_results = gr.Textbox(label="Results", lines=2, interactive=False)
813
-
814
- # Corporate Agent Row
815
- with gr.Row():
816
- gr.Markdown("#### 🏒 Corporate Agent")
817
- with gr.Row():
818
- with gr.Column(scale=2):
819
- corporate_upload = gr.File(
820
- label="Upload Files",
821
- file_count="multiple",
822
- file_types=[".xlsx", ".xls", ".csv"]
823
- )
824
- corporate_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
825
- with gr.Column(scale=2):
826
- corporate_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
827
- corporate_results = gr.Textbox(label="Results", lines=2, interactive=False)
828
-
829
- # Web Agent Row (Status only - web search focused)
830
- with gr.Row():
831
- gr.Markdown("#### 🌐 Web Agent")
832
  web_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
833
 
834
  # =============================
835
- # BOTTOM SECTION: Orchestrator & System Summary
836
  # =============================
837
  gr.Markdown("---")
838
- gr.Markdown("### 🎯 Orchestrator & System Control")
839
 
840
  with gr.Row():
841
  with gr.Column(scale=2):
842
- gr.Markdown("#### 🎯 Orchestrator")
 
843
  orchestrator_upload = gr.File(
844
  label="Upload Exception/Reconciliation Files",
845
  file_count="multiple",
846
  file_types=[".xlsx", ".xls", ".csv"]
847
  )
848
  orchestrator_process_btn = gr.Button("πŸ”„ Process Files", variant="primary")
 
849
  orchestrator_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
850
- orchestrator_results = gr.Textbox(label="Results", lines=3, interactive=False)
851
-
 
 
 
 
 
 
 
 
852
  with gr.Column(scale=2):
853
  gr.Markdown("#### πŸ“Š System Summary")
854
  summary_btn = gr.Button("πŸ“‹ Get All Agent Status", variant="primary")
855
- processing_summary = gr.Textbox(label="System Overview", lines=6, interactive=False)
856
 
857
  with gr.Column(scale=2):
858
  gr.Markdown("#### ⚠️ Exception Management")
@@ -864,20 +884,18 @@ def create_gradio_interface() -> gr.Blocks:
864
  )
865
  resolve_btn = gr.Button("βœ… Resolve", variant="stop")
866
  exceptions_btn = gr.Button("πŸ“„ List Exceptions")
 
 
 
 
 
 
867
 
868
- # Exception Results
869
  with gr.Row():
870
  resolution_output = gr.Textbox(label="Resolution Result", lines=2, interactive=False)
871
- exceptions_output = gr.Textbox(label="Current Exceptions", lines=4, interactive=False)
872
-
873
- # Demo Section (simplified)
874
- gr.Markdown("---")
875
- gr.Markdown("### πŸ§ͺ Quick Demo")
876
- with gr.Row():
877
- demo_normal_btn = gr.Button("🎯 Normal Trade", size="sm")
878
- demo_failed_btn = gr.Button("πŸ’₯ Failed Trade", size="sm")
879
- demo_corp_btn = gr.Button("🍎 Corporate Action", size="sm")
880
- demo_result = gr.Textbox(label="Demo Result", lines=3, interactive=False)
881
 
882
  # =============================
883
  # WIRE UP ALL CALLBACKS
 
723
  **Deployed on Hugging Face Spaces with built-in Excel MCP Server support**
724
  """)
725
 
726
+ # =============================
727
+ # CUSTODIAN AGENT SECTION
728
+ # =============================
729
+ gr.Markdown("---")
730
+ gr.Markdown("### πŸ›οΈ Custodian Agent")
731
+
732
  with gr.Row():
 
 
 
733
  with gr.Column(scale=2):
 
 
734
  custodian_prompt = gr.Textbox(
735
+ label="Instructions",
736
  placeholder="e.g., 'Look for AAPL positions affected by stock split'",
737
  lines=2
738
  )
739
+ with gr.Column(scale=2):
740
+ custodian_upload = gr.File(
741
+ label="Upload Files",
742
+ file_count="multiple",
743
+ file_types=[".xlsx", ".xls", ".csv"]
744
+ )
745
+ custodian_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
746
+ with gr.Column(scale=2):
747
+ custodian_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
748
+
749
+ custodian_results = gr.Textbox(label="Results", lines=2, interactive=False)
750
+
751
+ # =============================
752
+ # CASH AGENT SECTION
753
+ # =============================
754
+ gr.Markdown("---")
755
+ gr.Markdown("### πŸ’° Cash Agent")
756
+
757
+ with gr.Row():
758
+ with gr.Column(scale=2):
759
  cash_prompt = gr.Textbox(
760
+ label="Instructions",
761
  placeholder="e.g., 'Flag any trades over $1M requiring additional liquidity'",
762
  lines=2
763
  )
764
+ with gr.Column(scale=2):
765
+ cash_upload = gr.File(
766
+ label="Upload Files",
767
+ file_count="multiple",
768
+ file_types=[".xlsx", ".xls", ".csv"]
769
+ )
770
+ cash_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
771
+ with gr.Column(scale=2):
772
+ cash_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
773
+
774
+ cash_results = gr.Textbox(label="Results", lines=2, interactive=False)
775
+
776
+ # =============================
777
+ # TRADE AGENT SECTION
778
+ # =============================
779
+ gr.Markdown("---")
780
+ gr.Markdown("### πŸ“ˆ Trade Agent")
781
+
782
+ with gr.Row():
783
+ with gr.Column(scale=2):
784
  trade_prompt = gr.Textbox(
785
+ label="Instructions",
786
  placeholder="e.g., 'Combine related trades from same counterparty'",
787
  lines=2
788
  )
789
+ with gr.Column(scale=2):
790
+ trade_upload = gr.File(
791
+ label="Upload Files",
792
+ file_count="multiple",
793
+ file_types=[".xlsx", ".xls", ".csv"]
794
+ )
795
+ trade_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
796
+ with gr.Column(scale=2):
797
+ trade_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
798
+
799
+ trade_results = gr.Textbox(label="Results", lines=2, interactive=False)
800
+
801
+ # =============================
802
+ # CORPORATE AGENT SECTION
803
+ # =============================
804
+ gr.Markdown("---")
805
+ gr.Markdown("### 🏒 Corporate Agent")
806
+
807
+ with gr.Row():
808
+ with gr.Column(scale=2):
809
  corporate_prompt = gr.Textbox(
810
+ label="Instructions",
811
  placeholder="e.g., 'Check for dividend payments affecting settlement dates'",
812
  lines=2
813
  )
814
+ with gr.Column(scale=2):
815
+ corporate_upload = gr.File(
816
+ label="Upload Files",
817
+ file_count="multiple",
818
+ file_types=[".xlsx", ".xls", ".csv"]
819
+ )
820
+ corporate_process_btn = gr.Button("πŸ”„ Process Files", variant="secondary")
821
+ with gr.Column(scale=2):
822
+ corporate_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
823
+
824
+ corporate_results = gr.Textbox(label="Results", lines=2, interactive=False)
825
+
826
+ # =============================
827
+ # WEB AGENT SECTION
828
+ # =============================
829
+ gr.Markdown("---")
830
+ gr.Markdown("### 🌐 Web Agent")
831
+
832
+ with gr.Row():
833
+ with gr.Column(scale=2):
834
  web_prompt = gr.Textbox(
835
+ label="Instructions",
836
  placeholder="e.g., 'Search for AAPL stock split news, NVDA earnings updates, CTSH corporate actions'",
837
  lines=2
838
  )
839
+ with gr.Column(scale=2):
840
+ gr.Markdown("*Web agent searches for real-time market data*")
841
+ with gr.Column(scale=2):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842
  web_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
843
 
844
  # =============================
845
+ # ORCHESTRATOR SECTION
846
  # =============================
847
  gr.Markdown("---")
848
+ gr.Markdown("### 🎯 Orchestrator")
849
 
850
  with gr.Row():
851
  with gr.Column(scale=2):
852
+ gr.Markdown("*Orchestrator analyzes all agent results*")
853
+ with gr.Column(scale=2):
854
  orchestrator_upload = gr.File(
855
  label="Upload Exception/Reconciliation Files",
856
  file_count="multiple",
857
  file_types=[".xlsx", ".xls", ".csv"]
858
  )
859
  orchestrator_process_btn = gr.Button("πŸ”„ Process Files", variant="primary")
860
+ with gr.Column(scale=2):
861
  orchestrator_status = gr.Textbox(label="Status", lines=3, interactive=False, value="Ready")
862
+
863
+ orchestrator_results = gr.Textbox(label="Results", lines=2, interactive=False)
864
+
865
+ # =============================
866
+ # SYSTEM CONTROL SECTION
867
+ # =============================
868
+ gr.Markdown("---")
869
+ gr.Markdown("### πŸ“Š System Control & Exception Management")
870
+
871
+ with gr.Row():
872
  with gr.Column(scale=2):
873
  gr.Markdown("#### πŸ“Š System Summary")
874
  summary_btn = gr.Button("πŸ“‹ Get All Agent Status", variant="primary")
875
+ processing_summary = gr.Textbox(label="System Overview", lines=4, interactive=False)
876
 
877
  with gr.Column(scale=2):
878
  gr.Markdown("#### ⚠️ Exception Management")
 
884
  )
885
  resolve_btn = gr.Button("βœ… Resolve", variant="stop")
886
  exceptions_btn = gr.Button("πŸ“„ List Exceptions")
887
+
888
+ with gr.Column(scale=2):
889
+ gr.Markdown("#### πŸ§ͺ Quick Demo")
890
+ demo_normal_btn = gr.Button("🎯 Normal Trade", size="sm")
891
+ demo_failed_btn = gr.Button("πŸ’₯ Failed Trade", size="sm")
892
+ demo_corp_btn = gr.Button("🍎 Corporate Action", size="sm")
893
 
894
+ # Results Row
895
  with gr.Row():
896
  resolution_output = gr.Textbox(label="Resolution Result", lines=2, interactive=False)
897
+ exceptions_output = gr.Textbox(label="Current Exceptions", lines=2, interactive=False)
898
+ demo_result = gr.Textbox(label="Demo Result", lines=2, interactive=False)
 
 
 
 
 
 
 
 
899
 
900
  # =============================
901
  # WIRE UP ALL CALLBACKS