XPMaster commited on
Commit
c1e283b
·
1 Parent(s): 17cbc9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -46
app.py CHANGED
@@ -1,53 +1,30 @@
1
  import streamlit as st
2
- import pandas as pd
3
- import plotly.express as px
4
 
5
- # Sample DataFrame
6
- df = pd.DataFrame({
7
- "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
8
- "Amount": [4, 1, 2, 2, 4, 5],
9
- "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
10
- })
11
 
12
- # Create a Plotly Express figure for the bar chart
13
- fig_bar = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")
14
- fig_bar.update_layout(autosize=True, width=st.session_state.get('chart_width', 700))
15
-
16
- # Create another figure for a line chart
17
- fig_line = px.line(df, x="Fruit", y="Amount", color="City")
18
- fig_line.update_layout(autosize=True, width=st.session_state.get('chart_width', 700))
19
-
20
- # Session state for navigation
21
- if 'current_step' not in st.session_state:
22
- st.session_state['current_step'] = 1
23
-
24
- # Define navigation functions
25
- def go_to_step(step):
26
- st.session_state['current_step'] = step
27
-
28
- # Set the layout to wide
29
- st.set_page_config(layout="wide")
30
-
31
- # Layout
32
- st.title('Interactive Dashboard with Steps')
33
-
34
- # Set the width of the chart dynamically based on the page width
35
- st.session_state['chart_width'] = st.columns()[0].width
36
-
37
- # Button columns
38
- col1, col2 = st.columns([1, 5])
39
  with col1:
40
- # "Previous" button will be disabled on the first step
41
- prev_disabled = st.session_state['current_step'] == 1
42
- st.button('Previous Step', on_click=lambda: go_to_step(st.session_state['current_step'] - 1), disabled=prev_disabled)
 
 
43
 
 
44
  with col2:
45
- # "Next" button will be disabled on the last step
46
- next_disabled = st.session_state['current_step'] == 2
47
- st.button('Next Step', on_click=lambda: go_to_step(st.session_state['current_step'] + 1), disabled=next_disabled)
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- # Display the appropriate chart based on the current step
50
- if st.session_state['current_step'] == 1:
51
- st.plotly_chart(fig_bar)
52
- elif st.session_state['current_step'] == 2:
53
- st.plotly_chart(fig_line)
 
1
  import streamlit as st
 
 
2
 
3
+ # Creating three columns for the drag and drop areas
4
+ col1, col2, col3 = st.columns(3)
 
 
 
 
5
 
6
+ # Drag and Drop for Premium
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  with col1:
8
+ st.header("Premium")
9
+ premium_file = st.file_uploader("Drop your Premium CSV here", type=['csv'], key="premium")
10
+ if premium_file is not None:
11
+ # Unlock next step for Premium
12
+ st.button("Proceed with Premium Analysis", key="premium_proceed")
13
 
14
+ # Drag and Drop for Incurred Claims & Recoveries Data
15
  with col2:
16
+ st.header("Incurred Claims & Recoveries Data")
17
+ claims_data_file = st.file_uploader("Drop your Claims & Recoveries CSV here", type=['csv'], key="claims_data")
18
+ if claims_data_file is not None:
19
+ # Unlock next step for Incurred Claims & Recoveries Data
20
+ st.button("Proceed with Claims Data Analysis", key="claims_data_proceed")
21
+
22
+ # Drag and Drop for Claims Count
23
+ with col3:
24
+ st.header("Claims Count")
25
+ claims_count_file = st.file_uploader("Drop your Claims Count CSV here", type=['csv'], key="claims_count")
26
+ if claims_count_file is not None:
27
+ # Unlock next step for Claims Count
28
+ st.button("Proceed with Claims Count Analysis", key="claims_count_proceed")
29
+
30