santhosh commited on
Commit
76d2b9d
·
verified ·
1 Parent(s): e2f7a02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -28
app.py CHANGED
@@ -6,37 +6,10 @@ from datasets import load_dataset
6
  # Load data
7
  @st.cache_data # Cache data for performance improvement
8
  def load_data():
9
- dataset = load_dataset("santhosh/day_in_history", split="train")
10
  df = pd.DataFrame(dataset)
11
  return df
12
 
13
-
14
- # Function to process user input (date) and return description and reference
15
- def process_date(day, month, year=None):
16
- # Filter data based on selected date
17
- if year is None or year == "":
18
- filtered_data = df[(df["month"] == month) & (df["day"] == int(day))]
19
- else:
20
- filtered_data = df[
21
- (df["year"] == int(year)) & (df["month"] == month) & (df["day"] == int(day))
22
- ]
23
-
24
- if not filtered_data.empty:
25
- # Prepare empty lists to store descriptions and references
26
- descriptions = []
27
- references = []
28
-
29
- # Loop through filtered data and append descriptions and references
30
- for index, row in filtered_data.iterrows():
31
- descriptions.append(row["event_description"])
32
- references.append(row["reference"])
33
-
34
- # Return lists of descriptions and references
35
- return descriptions
36
- else:
37
- return [f"No data found for selected date {year} {month} {day}"]
38
-
39
-
40
  def main():
41
  df = load_data()
42
  # Page title and header
 
6
  # Load data
7
  @st.cache_data # Cache data for performance improvement
8
  def load_data():
9
+ dataset = load_dataset("santhosh/day_in_history", "en", split="train")
10
  df = pd.DataFrame(dataset)
11
  return df
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  def main():
14
  df = load_data()
15
  # Page title and header