Update app.py
Browse files
app.py
CHANGED
@@ -1655,7 +1655,7 @@ def create_gradio_app():
|
|
1655 |
|
1656 |
if not file:
|
1657 |
logger.warning("Missing file")
|
1658 |
-
return "", "", "",
|
1659 |
|
1660 |
# Validate file (file.name contains Gradio's temp path)
|
1661 |
logger.info(f"π VALIDATING FILE: {file.name}")
|
@@ -1664,7 +1664,7 @@ def create_gradio_app():
|
|
1664 |
|
1665 |
if not validation["valid"]:
|
1666 |
logger.error(f"β FILE VALIDATION FAILED: {validation['error']}")
|
1667 |
-
return "", "", "",
|
1668 |
|
1669 |
# Save file to our session directory
|
1670 |
logger.info("πΎ Saving uploaded file to session directory...")
|
@@ -1735,7 +1735,7 @@ def create_gradio_app():
|
|
1735 |
logger.info(f"π― WORKFLOW INITIALIZATION - Session: {ui.session_id}")
|
1736 |
logger.info(f"π Document: {temp_path}")
|
1737 |
logger.info("β‘ Starting multi-step financial analysis workflow...")
|
1738 |
-
yield (progress_html, create_step_html("extraction"), "", gr.Column(visible=False))
|
1739 |
|
1740 |
time.sleep(1) # Brief pause for UI update
|
1741 |
|
@@ -1745,7 +1745,7 @@ def create_gradio_app():
|
|
1745 |
logger.info("=" * 60)
|
1746 |
logger.info("π Initializing financial data extraction agent...")
|
1747 |
progress_html = "π <strong>Step 1/4: Extracting financial data from document...</strong>"
|
1748 |
-
yield (progress_html, create_step_html("extraction"), "", gr.Column(visible=False))
|
1749 |
|
1750 |
# Check for cached extraction
|
1751 |
if "extracted_data" in ui.workflow.session_state:
|
@@ -1794,7 +1794,7 @@ def create_gradio_app():
|
|
1794 |
logger.info("π STEP 2/4: DATA ORGANIZATION PHASE")
|
1795 |
logger.info("=" * 60)
|
1796 |
progress_html = "π <strong>Step 2/4: Organizing and analyzing financial data...</strong>"
|
1797 |
-
yield (progress_html, create_step_html("arrangement"), "", gr.Column(visible=False))
|
1798 |
|
1799 |
if "arrangement_response" in ui.workflow.session_state:
|
1800 |
logger.info("πΎ Using cached data arrangement from previous run")
|
@@ -1856,7 +1856,7 @@ def create_gradio_app():
|
|
1856 |
# Step 3: Code Generation
|
1857 |
logger.info("Step 3: Starting code generation...")
|
1858 |
progress_html = "π» <strong>Step 3/4: Generating Python code for Excel reports...</strong>"
|
1859 |
-
yield (progress_html, create_step_html("code_generation"), "", gr.Column(visible=False))
|
1860 |
|
1861 |
if "code_generation_response" in ui.workflow.session_state:
|
1862 |
logger.info("Using cached code generation results from previous run")
|
@@ -1917,7 +1917,7 @@ def create_gradio_app():
|
|
1917 |
# Step 4: Final Results
|
1918 |
logger.info("Step 4: Preparing final results...")
|
1919 |
progress_html = "π <strong>Step 4/4: Creating final Excel report...</strong>"
|
1920 |
-
yield (progress_html, create_step_html("execution"), "", gr.Column(visible=False))
|
1921 |
|
1922 |
time.sleep(1) # Brief pause to show step
|
1923 |
|
@@ -2351,7 +2351,7 @@ def main():
|
|
2351 |
app.launch(
|
2352 |
server_name="0.0.0.0",
|
2353 |
server_port=7860,
|
2354 |
-
share=
|
2355 |
debug=False,
|
2356 |
show_error=True,
|
2357 |
)
|
|
|
1655 |
|
1656 |
if not file:
|
1657 |
logger.warning("Missing file")
|
1658 |
+
return "", "", "", gr.Column(visible=False), session_state
|
1659 |
|
1660 |
# Validate file (file.name contains Gradio's temp path)
|
1661 |
logger.info(f"π VALIDATING FILE: {file.name}")
|
|
|
1664 |
|
1665 |
if not validation["valid"]:
|
1666 |
logger.error(f"β FILE VALIDATION FAILED: {validation['error']}")
|
1667 |
+
return "", "", "", gr.Column(visible=False), session_state
|
1668 |
|
1669 |
# Save file to our session directory
|
1670 |
logger.info("πΎ Saving uploaded file to session directory...")
|
|
|
1735 |
logger.info(f"π― WORKFLOW INITIALIZATION - Session: {ui.session_id}")
|
1736 |
logger.info(f"π Document: {temp_path}")
|
1737 |
logger.info("β‘ Starting multi-step financial analysis workflow...")
|
1738 |
+
yield (progress_html, create_step_html("extraction"), "", gr.Column(visible=False), session_state)
|
1739 |
|
1740 |
time.sleep(1) # Brief pause for UI update
|
1741 |
|
|
|
1745 |
logger.info("=" * 60)
|
1746 |
logger.info("π Initializing financial data extraction agent...")
|
1747 |
progress_html = "π <strong>Step 1/4: Extracting financial data from document...</strong>"
|
1748 |
+
yield (progress_html, create_step_html("extraction"), "", gr.Column(visible=False), session_state)
|
1749 |
|
1750 |
# Check for cached extraction
|
1751 |
if "extracted_data" in ui.workflow.session_state:
|
|
|
1794 |
logger.info("π STEP 2/4: DATA ORGANIZATION PHASE")
|
1795 |
logger.info("=" * 60)
|
1796 |
progress_html = "π <strong>Step 2/4: Organizing and analyzing financial data...</strong>"
|
1797 |
+
yield (progress_html, create_step_html("arrangement"), "", gr.Column(visible=False), session_state)
|
1798 |
|
1799 |
if "arrangement_response" in ui.workflow.session_state:
|
1800 |
logger.info("πΎ Using cached data arrangement from previous run")
|
|
|
1856 |
# Step 3: Code Generation
|
1857 |
logger.info("Step 3: Starting code generation...")
|
1858 |
progress_html = "π» <strong>Step 3/4: Generating Python code for Excel reports...</strong>"
|
1859 |
+
yield (progress_html, create_step_html("code_generation"), "", gr.Column(visible=False), session_state)
|
1860 |
|
1861 |
if "code_generation_response" in ui.workflow.session_state:
|
1862 |
logger.info("Using cached code generation results from previous run")
|
|
|
1917 |
# Step 4: Final Results
|
1918 |
logger.info("Step 4: Preparing final results...")
|
1919 |
progress_html = "π <strong>Step 4/4: Creating final Excel report...</strong>"
|
1920 |
+
yield (progress_html, create_step_html("execution"), "", gr.Column(visible=False), session_state)
|
1921 |
|
1922 |
time.sleep(1) # Brief pause to show step
|
1923 |
|
|
|
2351 |
app.launch(
|
2352 |
server_name="0.0.0.0",
|
2353 |
server_port=7860,
|
2354 |
+
share=True,
|
2355 |
debug=False,
|
2356 |
show_error=True,
|
2357 |
)
|