Bexaga commited on
Commit
3003dd5
·
verified ·
1 Parent(s): 2813e54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -2,20 +2,20 @@ import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
4
 
5
- # Load the Excel file
6
- def load_data(file_path):
7
- return pd.read_excel(file_path)
8
 
9
  # Function to filter data
10
- def filter_data(df, region, start_date, end_date):
11
- filtered_df = df[(df['Region'] == region) &
12
- (df['Start Date'] >= start_date) &
13
- (df['End Date'] <= end_date)]
14
  return filtered_df
15
 
16
  # Function to create timeline
17
  def create_timeline(df):
18
- fig = px.timeline(df, x_start="Start Date", x_end="End Date", y="Conference Name", color="Region", title="Conference Timeline")
19
  fig.update_yaxes(categoryorder="total ascending")
20
  return fig
21
 
@@ -23,23 +23,25 @@ def create_timeline(df):
23
  def main():
24
  st.title("AI Conferences Timeline")
25
 
26
- # Load data
27
- file_path = "AI-Conferences.xls" # Update with the correct path if needed
28
- data = load_data(file_path)
29
 
30
  # Sidebar for filters
31
  st.sidebar.header("Filter Options")
32
- regions = data['Region'].unique()
33
- selected_region = st.sidebar.selectbox("Select Region", regions)
34
- start_date = st.sidebar.date_input("Start Date", data['Start Date'].min())
35
- end_date = st.sidebar.date_input("End Date", data['End Date'].max())
 
 
36
 
37
  # Filter data based on user input
38
- filtered_data = filter_data(data, selected_region, start_date, end_date)
39
 
40
  # Display filtered data
41
  st.subheader("Filtered Conferences")
42
- st.dataframe(filtered_data)
43
 
44
  # Create and display timeline
45
  st.subheader("Conference Timeline")
 
2
  import pandas as pd
3
  import plotly.express as px
4
 
5
+ # Load the Excel file from a URL
6
+ def load_data(url):
7
+ return pd.read_excel(url)
8
 
9
  # Function to filter data
10
+ def filter_data(df, location_region, priority, month):
11
+ filtered_df = df[(df['Location Region'] == location_region) &
12
+ (df['Priority'] == priority) &
13
+ (df['Month'] == month)]
14
  return filtered_df
15
 
16
  # Function to create timeline
17
  def create_timeline(df):
18
+ fig = px.timeline(df, x_start="Actual Date", x_end="Actual Date", y="Name", color="Location Region", title="Conference Timeline")
19
  fig.update_yaxes(categoryorder="total ascending")
20
  return fig
21
 
 
23
  def main():
24
  st.title("AI Conferences Timeline")
25
 
26
+ # Load data from URL
27
+ url = "https://huggingface.co/datasets/Bexaga/AI-Conference/resolve/main/AI%20conferences%202025.xlsx"
28
+ data = load_data(url)
29
 
30
  # Sidebar for filters
31
  st.sidebar.header("Filter Options")
32
+ location_regions = data['Location Region'].unique()
33
+ selected_location_region = st.sidebar.selectbox("Select Location Region", location_regions)
34
+ priorities = data['Priority'].unique()
35
+ selected_priority = st.sidebar.selectbox("Select Priority", priorities)
36
+ months = data['Month'].unique()
37
+ selected_month = st.sidebar.selectbox("Select Month", months)
38
 
39
  # Filter data based on user input
40
+ filtered_data = filter_data(data, selected_location_region, selected_priority, selected_month)
41
 
42
  # Display filtered data
43
  st.subheader("Filtered Conferences")
44
+ st.dataframe(filtered_data[['Category', 'Name', 'Priority', 'Coverage', 'Month', 'Actual Date', 'Date status', 'URL', 'Location Region', 'Location']])
45
 
46
  # Create and display timeline
47
  st.subheader("Conference Timeline")