kreemyyyy commited on
Commit
a3de3da
·
verified ·
1 Parent(s): af26c90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -3,13 +3,16 @@ import gradio as gr
3
 
4
  # Pivot between Model↔Texter schedules (7-day weekly format)
5
  def convert_schedule(file_path, direction):
6
- # 1. Load schedule: first column is index (Model or Texter), headers are days of the week
7
- df = pd.read_excel(file_path, index_col=0)
8
- # Ensure headers are strings and drop any 'Unnamed' placeholders
9
- df.columns = df.columns.astype(str)
 
 
 
10
  df = df.loc[:, ~df.columns.str.match(r'^Unnamed')]
11
 
12
- # Determine the name of the index column after reset_index()
13
  index_name = df.index.name or 'index'
14
 
15
  # 2. Setup melting parameters based on direction
@@ -62,4 +65,4 @@ iface = gr.Interface(
62
  )
63
 
64
  if __name__ == '__main__':
65
- iface.launch(server_name='0.0.0.0', server_port=7860)
 
3
 
4
  # Pivot between Model↔Texter schedules (7-day weekly format)
5
  def convert_schedule(file_path, direction):
6
+ # 1. Load schedule: first column is index; use two header rows to capture proper day labels
7
+ df = pd.read_excel(file_path, header=[0,1], index_col=0)
8
+ # Combine multi-index headers: take the second row (actual day names)
9
+ # level 0 may contain merged group labels (e.g., timeslot), level 1 has actual dates/days
10
+ df.columns = df.columns.get_level_values(1).astype(str)
11
+
12
+ # Drop any 'Unnamed' or blank day columns
13
  df = df.loc[:, ~df.columns.str.match(r'^Unnamed')]
14
 
15
+ # Determine the name of the index column after reset_index()()
16
  index_name = df.index.name or 'index'
17
 
18
  # 2. Setup melting parameters based on direction
 
65
  )
66
 
67
  if __name__ == '__main__':
68
+ iface.launch(server_name='0.0.0.0', server_port=7860)