ZainMalik0925 commited on
Commit
a68b099
·
verified ·
1 Parent(s): 2c62b10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -4,7 +4,7 @@ import plotly.express as px
4
 
5
  # Add custom CSS for the background
6
  def add_background():
7
- background_url = "https://huggingface.co/spaces/ZainMalik0925/GreenLensAI_LCA/resolve/main/BCK2.jpg"
8
  css = f"""
9
  <style>
10
  .stApp {{
@@ -23,7 +23,7 @@ st.set_page_config(page_title="GreenLens AI", layout="wide")
23
  # Call the background function to load the background silently
24
  add_background()
25
 
26
- # Title and subtitle with updated color
27
  st.markdown("<h1 style='text-align: center; color: white;'>GreenLens AI</h1>", unsafe_allow_html=True)
28
  st.markdown(
29
  """
@@ -85,7 +85,7 @@ def calculate_footprints(weight, composition, lifecycle_inputs):
85
  # Sidebar inputs
86
  def get_inputs(prefix):
87
  weight = st.sidebar.number_input(f"{prefix} Product Weight (kg)", min_value=0.0, value=0.0, step=0.01, key=f"{prefix}_weight")
88
- st.sidebar.subheader(f"{prefix} Material Composition (%)")
89
  cotton = st.sidebar.number_input("Conventional Cotton (%)", 0, 100, 0, step=1, key=f"{prefix}_cotton")
90
  polyester = st.sidebar.number_input("Polyester (%)", 0, 100, 0, step=1, key=f"{prefix}_polyester")
91
  nylon = st.sidebar.number_input("Nylon 6 (%)", 0, 100, 0, step=1, key=f"{prefix}_nylon")
@@ -115,9 +115,10 @@ def get_inputs(prefix):
115
  # Adjust graph styling
116
  def style_figure(fig):
117
  fig.update_layout(
118
- plot_bgcolor="rgba(0,0,0,0.7)", # 70% opacity
119
- paper_bgcolor="rgba(0,0,0,0.7)", # 70% opacity
120
- font=dict(color="white"), # White font for better visibility
 
121
  )
122
  fig.update_traces(marker_color="white") # Change bar color to white
123
  return fig
 
4
 
5
  # Add custom CSS for the background
6
  def add_background():
7
+ background_url = "https://huggingface.co/spaces/ZainMalik0925/GreenLensAI_LCA/resolve/main/BCK1.jpg"
8
  css = f"""
9
  <style>
10
  .stApp {{
 
23
  # Call the background function to load the background silently
24
  add_background()
25
 
26
+ # Title and subtitle with updated color to white
27
  st.markdown("<h1 style='text-align: center; color: white;'>GreenLens AI</h1>", unsafe_allow_html=True)
28
  st.markdown(
29
  """
 
85
  # Sidebar inputs
86
  def get_inputs(prefix):
87
  weight = st.sidebar.number_input(f"{prefix} Product Weight (kg)", min_value=0.0, value=0.0, step=0.01, key=f"{prefix}_weight")
88
+ st.sidebar.markdown(f"<h3 style='color: white;'>{prefix} Material Composition (%)</h3>", unsafe_allow_html=True)
89
  cotton = st.sidebar.number_input("Conventional Cotton (%)", 0, 100, 0, step=1, key=f"{prefix}_cotton")
90
  polyester = st.sidebar.number_input("Polyester (%)", 0, 100, 0, step=1, key=f"{prefix}_polyester")
91
  nylon = st.sidebar.number_input("Nylon 6 (%)", 0, 100, 0, step=1, key=f"{prefix}_nylon")
 
115
  # Adjust graph styling
116
  def style_figure(fig):
117
  fig.update_layout(
118
+ plot_bgcolor="rgba(0,0,0,0.8)", # 20% transparency
119
+ paper_bgcolor="rgba(0,0,0,0.8)", # 20% transparency
120
+ font=dict(color="white"), # Font color set to white
121
+ legend=dict(font=dict(color="white")) # Set legend text to white
122
  )
123
  fig.update_traces(marker_color="white") # Change bar color to white
124
  return fig