MaheshP98 commited on
Commit
6ae10df
·
verified ·
1 Parent(s): 9b38c4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -12,6 +12,7 @@ from reportlab.lib.utils import ImageReader
12
  from reportlab.lib.colors import red, black
13
  import requests
14
  from simple_salesforce import Salesforce
 
15
 
16
  # Set up logging
17
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
@@ -27,7 +28,7 @@ SF_INSTANCE_URL = os.getenv("SF_INSTANCE_URL", "https://budgetoverrunriskestimat
27
 
28
  # Validate environment variables
29
  if not HF_TOKEN:
30
- logger.error("Hugging Face token not set. Please add HF_TOKEN to .env file.")
31
  else:
32
  logger.info("Hugging Face token loaded successfully.")
33
 
@@ -94,7 +95,7 @@ def fetch_budget_from_salesforce(project_id):
94
  return df, None
95
  except Exception as e:
96
  logger.error(f"Error fetching data from Salesforce: {str(e)}")
97
- return None, f"Error fetching data from Salesforce: {str(e)}"
98
 
99
  # Function to process uploaded file for line items
100
  def process_uploaded_file(file):
@@ -626,7 +627,7 @@ custom_css = """
626
  align-items: center !important;
627
  justify-content: center !important;
628
  }
629
- #submit-button:hover {
630
  background-color: #E6C200 !important;
631
  }
632
  """
@@ -646,7 +647,7 @@ with gr.Blocks(title="Budget Overrun Risk Estimator", css=custom_css) as demo:
646
  material_cost_input = gr.Textbox(label="Material Cost Index", placeholder="Enter material cost index (e.g., 120)")
647
  material_cost_explanation = gr.Markdown(update_material_cost_explanation("Plumbing"))
648
 
649
- labor_index_input = gr.Textbox(label="Labor Index", placeholder="Enter labor index (e.g., 30)")
650
  labor_index_explanation = gr.Markdown(update_labor_explanation("Plumbing"))
651
 
652
  scope_change_input = gr.Textbox(label="Scope Change Impact (%)", placeholder="Enter scope change impact as a percentage (e.g., 10 for 10%)")
 
12
  from reportlab.lib.colors import red, black
13
  import requests
14
  from simple_salesforce import Salesforce
15
+ import gradio as gr # Added to fix NameError
16
 
17
  # Set up logging
18
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
 
28
 
29
  # Validate environment variables
30
  if not HF_TOKEN:
31
+ logger.error("Hugging Face token not set. Please add HF_TOKEN to .env file or Space Secrets.")
32
  else:
33
  logger.info("Hugging Face token loaded successfully.")
34
 
 
95
  return df, None
96
  except Exception as e:
97
  logger.error(f"Error fetching data from Salesforce: {str(e)}")
98
+ return None, f"Error fetching data: {str(e)}"
99
 
100
  # Function to process uploaded file for line items
101
  def process_uploaded_file(file):
 
627
  align-items: center !important;
628
  justify-content: center !important;
629
  }
630
+ #custom_css:hover {
631
  background-color: #E6C200 !important;
632
  }
633
  """
 
647
  material_cost_input = gr.Textbox(label="Material Cost Index", placeholder="Enter material cost index (e.g., 120)")
648
  material_cost_explanation = gr.Markdown(update_material_cost_explanation("Plumbing"))
649
 
650
+ labor_index_input = gr.Textbox(label="Labor Index", placeholder="Enter labor index (e.g., 130)")
651
  labor_index_explanation = gr.Markdown(update_labor_explanation("Plumbing"))
652
 
653
  scope_change_input = gr.Textbox(label="Scope Change Impact (%)", placeholder="Enter scope change impact as a percentage (e.g., 10 for 10%)")